That problem with Sessions on IE6

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

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

My setup:

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

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

Thanks

Jason

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 the 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 can 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 site dies, the person is logged out.

This is unreal.

Jason

Ok, I finally found a lead. Aparently, IE 6 (and maybe 7) suck at handling sessions. Basically after the session size gets to 4k or 20 cookies for a 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).

Jason

To have a sense of closure on the thread:

My issue is something special. I don’t know how this worked in any browser. 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”
}

became

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]
end

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

Hack fix: save the values twice in the session.

I’m so confused.

Jason