That problem with Sessions on IE6

Does anyone know how to fix this problem? I’ve seen only a few people
have worked on this problem, but no-one has posted what exactly is
and how to fix it.

Basically, I lose my session randomly while on IE6. The site works
fine on any other browser.

My setup:

Apache w/ FastCGI
Rails Edge 6512 (1.2.x)
Ubuntu 6.06

This is driving me absolutely nuts. Can anyone help me here?



On 6/1/07, Jason R. [email protected] wrote:

Rails Edge 6512 (1.2.x)
Ubuntu 6.06

This is driving me absolutely nuts. Can anyone help me here?



Are you opening another window (via Javascript)? In a previous life,
in an ASP application (which stored a session ID in a cookie), when
the code would open another window, the session ID would get reset,
effectively erasing the session variables I had. Took forever to
figure out what was happening. Unfortunately, I could never find a fix

  • it’s a nasty bug in IE.

This is straight running through the application. No new windows, only
simple display Javascript. I just tried with pStore, and I noticed that
date on the server was off, but fixing that didn’t change a thing.

I guess I have to not use the session. The odd thing for me is that I
use the session, just not here. People can log into the site just fine,
though yeah, the session must be getting reset for me too as when the
dies, the person is logged out.

This is unreal.


Ok, I finally found a lead. Aparently, IE 6 (and maybe 7) suck at
sessions. Basically after the session size gets to 4k or 20 cookies for
given domain name, IE drops the session cookie first to make space.

So for now I’m fixing this code to use the session as little as possible
(which is a good idea anyway).


To have a sense of closure on the thread:

My issue is something special. I don’t know how this worked in any
Basically I wasn’t losing the whole session, just two fields that
corresponded to foreign keys. So:

session[:obj] = {
:for_key_1_id => 1,
:for_key_2_id => 3,
:some_string => “string”


session[:obj] = {
:for_key_1_id => nil,
:for_key_2_id => nil,
:some_string => “string”

I think this happened when I pulled out the information for a view:

def action
@for_key_1_id = session[:obj][:for_key_1_id]
@for_key_2_id = session[:obj][:for_key_2_id]

like this information was GC’d, or just lost. Why I have no idea, and
even more confusing as to why this worked in Firefox.

Hack fix: save the values twice in the session.

I’m so confused.


Well, I have spent three days trying to resolve the same issue.
Finally I caught the problem.
I don´t know if my case applies to yours but I will talk about mine, and
maybe it can help you.

I will try to explain the thing in a simplified sample.
I have written a REST application for controlling production in a plant.
People login with the machine they are working at that moment, and the
first page shows information about the current operarion in that
machine. Sometimes there was a image of the product they are
manufacturing, but others there wasnt. It warks without problem with firefox, but not with IE6 or IE7. The page was always displayed correctly, the image was not showed. Everything continued well with firefox but not with the Microsoft browsers. In these, the next action you try always redirected to the login page, as if the registered machine_id in session were lost. I study the logs made with firefox and ie with a diff application, and see that IE made a weird access to the server when it need the image that was not there. It request an url that was not planned, calling the index action insted the show with and id. I don´t know why. What happend was that this call was cancelled by a filter, and redirected to the login action where I reset the session information. Actually it wasnt IE that missed the session as I thought.

Maybe it can help you.
Good luck.