I am aware of discussions like PHP Session ID Duplication? and How unique is the php session id but I have come up with an issue that seems to act like duplicate sessions and cannot figure out what may be causing it.
There is a Yii 1.1 application running on PHP 5.5, and the setup includes two Apache Web Servers, Load Balanced (BigIp), and two Memcache Servers for User Data caching as well as Session Handling. Average traffic is around 10,000 visitors a day logging into the app.
First incident was reported after a load balancer failover. However, since then, there has been a session logging mechanism implementation over MySQL in order to track generated Sessions to each logged-in user and prevent the case of another user logging in with a previously generated session.
If a duplicate session is captured, the user is logged out, and session is regenerated.
The result so far indicates that almost every day there is at least one or two cases of users having acquired a duplicate session, so the implemented mechanism kicks in to settle it.
Although it is strongly suggested that such an event is highly unlikely to be met in an application's lifetime, I still monitor logs suggesting that something weird is going on. I could use some advice on what could cause the issue.
Another issue that I believe may somehow be connected, is that although one's session expires after 10 minutes of no activity, it is quite often noticed that a user will have logged in 3-4 times within 10 minutes, which in my eyes seem like an indication of memcache randomly losing sessions.
The setup doesn't use sticky sessions, which means each user request is served randomly over server 1 or server 2.
Does it seem like
- A resources setup issue? (Apache, BigIP etc.?)
- Application issue? Generating over and over same sessions?
- Memcache issue?
- Something else?
I was making some further searches and I came across this term that I think better suits what I am describing: "Session crossover".