Today, I faced a challenge in a project where some session variables are being lost on page reload while some others are retained.
I tried google but none of the solutions I found was able to help since not all the variables were lost. I am not new to sessions so I had already done a lot of troubleshooting myself before I went online.
It took a couple of hour before I figured out what the problem was and I decided to share my findings.
You can store as much data as you like within sessions. All sessions are stored on the server and the only limits you can reach is the maximum memory a script can consume at one time.
In my case, I had fetched a large tinyblob column from mysql database and stored it in the session by mistake. It consumed all the variable space left for the session storage and hence, all other session variables stored afterwards did not save.
I simply removed the code saving the tinyblob in the session and my project went back to normal.
I hope this helps someone.