Re: SESSION LOST!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Le jeudi 10 mai 2007 à 15:24 +0200, Oliver Block a écrit :
> Am Donnerstag, 10. Mai 2007 08:59 schrieb Sascha Braun:
> > but after a little
> > time, the session is just lost.
> 
> That doesn't say anything to me. Could you be more verbose on what you mean by 
> "the sessin is lost"?

:-)

I get that too and it's the best description I could give in one
sentence. Basically, the session array $_SESSION is emptied. Without
notice, warning or error. Just emptied.

I tried to track it down with xdebug as well but it's really just
loosing it.

I will try to work on this problem this week, and basically looking at
the last hundreds of posts about sessions in this list, I would narrow
it down to the following possible problems and solutions:

1) Unsynched:
It is possible that client and server do not share the same notion of
time, which is stored in the session cookies, so the session would be
expired sooner than expected. A way to test if this is the problem is to
set the cookie lifetime to one year or more, and see if it improves
anything. However, if this was the problem, timeouts would tend to
happen after a definite period of time, not after a random period like I
have and like Sascha seems to have as well

2) Mutex 1:
The problem might be due to concurrent (or almost) uses of the session,
either with AJAX code or with frames, which might mean that the sessions
are not complete when accessed, or access is prevented by a blocking
write operation on the session file. This should only happen in the
context of concurrent requests, and the only possible improvement might
be to use session_write_close() as soon as a session use is finished, or
to use mutex-aware session handler functions.
I wonder if, in this case, the session should really be lost and
emptied... maybe a write still allows a read to work...

3) Mutex 2:
When using alternative session handlers, these session handlers might
not be mutex-aware, so a concurrent access prevents data from being
written before it is read. Make sure your session handling code is
mutex-aware (apparently there is some code documented in the user
comments of the PHP online doc).

I hope this helps. I'll try to come back and report if any of these
solutions has worked for me.

Yannick

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux