Concurrent Access to same Session wrt Lock Time-out - what is it?

K

Kevin Frey

Hello,

I've been reading that ASP.NET serialises (ie. processes one at a time) HTTP
requests if two simultaneous requests need to access the same session state.
It also makes note that ASP.NET tries to reacquire a lock on the session
state every 1/2 second until the timeout is reached, and then it will
forcibly release the previous users lock and take the lock for itself.

What is this timeout figure?

One of our Session state values is a live object that represents a
connection to an application server (in the future we'll dispense with this
and instantiate-on-demand using a "lightweight" connection, but we can't
right now), and it looks very much like two requests are hitting our
"connection" object simultaneously, resulting in dodgy behaviour, exceptions
etc.

Since ASP.NET is meant to protect us from having to manage this ourself, I'm
wondering what the timeout is (at which point you lose the protection of
ASP.NET).

Even a ballpark figure would be appreciated - seconds, minutes, hours?

Thanks

Kevin
 
G

Guest

Kevin,
Session is per user can you rephrase your question to take this into account?

Thanks
DWS
 
K

Kevin Frey

I've found the cause of my problem (unrelated), but for interests sake, I'll
ask the question anyway:

Scenario:

User 1 commences a session with the web server (producing SessionId 1).

They then use "File->New Window" to open a second window. Both windows are
now associated with SessionId = 1.

In the first window the user issues a request for a .aspx page. Assuming the
first page takes several seconds to process; the user immediately then
issues another request in the second window.

At this point the web server is now seeing two requests for the SAME
SessionId. ASP.NET serialises (sequences) the requests so that only one
request runs at a time, because otherwise running both requests
simultaneously might corrupt Session data (depending on what the ASP.NET
page code does).

ASP.NET only waits a certain amount of time for the first request to finish,
before it "takes over" the session lock.

I want to know how long that time is, before ASP.NET will forcibly take over
the lock. The nett result is that on a long-running (?) page, ASP.NET might
in fact allow another request to start before the first one has finished.

I think my original question implied this - because two requests needing to
access the SAME session state implies the same Session Id. But I'm still
interested in the answer.

Thanks

Kevin
 
Joined
Mar 6, 2008
Messages
1
Reaction score
0
Concurrently opened windows with same session

I am having this very issue that Kevin has described, any solutions? Is there a way to reload the session if one of the instances can detect the session is outdated?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top