Magento – Magento randomly logging us out on Admin and customers out of front end

magento-1.9

We've got a very odd issue with our Magento 1.9.0.1 installation which has suddenly started periodically logging us out of the back end whilst simultaneously on the front end it seems to forget peoples session. So on the back end you're suddenly sent to the log in page and even if you can log in again you get logged out pretty much straight away if you click on anything. Then on the front end weird things happen like if you click 'add to basket' it just sends customers to 'there is nothing in your basket' page. Refreshing the page sometimes puts the item back in the basket. If customers are logged in then suddenly they are logged out as well. It's like it's alternating between forgetting and remembering the session.

We have 2 web servers, a database server and a load balancer. My thought was it was an issue with the sessions being stored incorrectly but the hosting company have investigated and everything seems correct from their end. We store sessions in redis across both servers.

It only happens periodically – like once a day for approx 20-30 mins which makes it infuriating to capture. By the time I get hold of the server company it's starting to resolve itself and they can't replicate the issue.

Long shot but anyone any ideas what could be causing this?

Thanks

Best Answer

If you have two frontends you are probably facing a session issue.

Make sure you are using a shared session backend.

If you are using redis make sure both the frontend are configured to access the same installation. Otherwise just make sure you are using database stored sessions.

In your app/etc/local.xml file make sure you have:

<session_save>db</session_save>

One other problem could be a time gap between your two frontends. Make sure you have the same time on both of them.

P.S: Remember to flush the cache.

Related Topic