On 1/30/07, Todd Finney <[EMAIL PROTECTED]> wrote:
The sessions are modified on every request, to set a last_access time, and they're modified on login to set an authentication token. I can't think of circumstances under which two different requests would attempt to modify a given session at the same time.
The biggest risks are things like multiple windows, AJAX calls, or some kind of auth handler that needs to load the session for every image request.
As much as I'd really like to understand what's actually happening here, I'll switch to A::S::Lock::Null if you think that's the best bet.
For many people it is, but I can't say for certain if it is for you. There may be a simpler solution. See below.
I don't see an example in the Apache::Session docs for switching the locking class, though - may I have a pointer?
You can either use Apache::Session::Flex or make your own Apache::Session::MySQL. Open up Apache::Session::MySQL and look at the code. It's nothing more than a config file. If you copy it, change the name (and package), and change the name of the locking class, that will work. As for what's going wrong, my guess is that it has to do with the internal redirects that happen when you access / as opposed to /index.phtml. You are trying to open the session in the HeaderParserHandler phase, so it's going to open a session, then do an internal redirect, and try to open the same session again, effectively deadlocking. But why does that $r->pnotes call make all the difference? Because pnotes() is special, as described here: http://perl.apache.org/docs/2.0/api/Apache2/RequestUtil.html#C_pnotes_ That's a 2.0 doc, but it applies to 1.0 as well: pnotes() increases the reference count to $session rather than copying it, so it doesn't get destroyed until after the internal redirect has completed and pnotes gets torn down. If you use a temporary variable to hold the _session_id key, this will not happen and that may fix your problem. I could rant about all the things that bother me about Apache::Session, but the bottom line is what works for you. Try the suggestions here and good luck. - Perrin