Re: Sessions drop?

Originally Posted by
tday.tk87
La sao?
Huh???? Please don't post into threads if you can't add anything to the discussion.
As for the original question:
I'm not saying that this is definitely what's going on; it's just the merest supposition on my part, but... you are working in an environment where the "server" is actually a cluster of machines, and there is no guarantee that your users are going to be connected to the same physical server with every page request. If the sessions are stored in a way that can make the session created on one physical server inaccessible to other servers in the cluster, then a perfectly valid session may appear to have been timed out or terminated when the user goes to a different page. This can happen whenever network difficulties (routing problems, issues with the cluster controller, sheer volume of traffic) prevent the two (or more) machines from synchronizing properly on schedule. And it may be one of those coming-and-going problems that's difficult to identify, since it won't affect all users and all sessions equally -- a user who is directed to the same physical server on every request by the load balancer will never experience the issue, while another user who is unlucky enough to be bounced from one machine to another all of the time will appear to have major authentication problems. And it will often be temporary and self-healing. All in all, it's a real SOB to pin down.
One way around the problem is to use a database (rather than the filesystem) to store sessions. Database replication (if multiple replicas of the database on different servers are being used) is usually much more efficient and reliable than file system synchronization, so things like traffic will have less of an impact. Again, I'm not sure of the network topology here, but it's normal to have several clustered web servers all addressing a single database server and save replicas for backup and failover, so replication delays from the active server to the backup/failover server is usually not an issue until something big goes wrong -- you will see stale-data issues as well as occasional session problems.
So, the TL;DR version is: do nothing and wait out what may be datacenter network issues, or move your session handling to MySQL.
“Beware of bugs in the above code; I have only proved it correct, not tried it.” --Donald Knuth
"It was as if its architects were given a perfectly good hammer and gleefully replied, 'neat! With this hammer, we can build a tool that can pound in nails.'" -- Alex Papadimoulis (on TheDailyWTF.com)