# That problem with Sessions on IE6

**URL:** <https://www.ruby-forum.com/t/that-problem-with-sessions-on-ie6/105708>\
**Category:** Rails\
**Created:** [June 1, 2007, 4:56pm UTC](https://www.ruby-forum.com/t/that-problem-with-sessions-on-ie6/105708 "2007-06-01T16:56:23Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jruyle](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/d2c977/32.png) [@jruyle](https://www.ruby-forum.com/u/jruyle)\
**Post date:** [June 1, 2007, 4:56pm UTC](https://www.ruby-forum.com/t/that-problem-with-sessions-on-ie6/105708/1 "2007-06-01T16:56:23Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jruyle](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/d2c977/32.png) [@jruyle](https://www.ruby-forum.com/u/jruyle)\
**Post date:** [June 1, 2007, 5:08pm UTC](https://www.ruby-forum.com/t/that-problem-with-sessions-on-ie6/105708/2 "2007-06-01T17:08:27Z")

</div>

On 6/1/07, Jason R. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> 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.

---

<div class="post-metadata">

**Author:** ![jruyle](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/d2c977/32.png) [@jruyle](https://www.ruby-forum.com/u/jruyle)\
**Post date:** [June 1, 2007, 5:28pm UTC](https://www.ruby-forum.com/t/that-problem-with-sessions-on-ie6/105708/3 "2007-06-01T17:28:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jruyle](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/d2c977/32.png) [@jruyle](https://www.ruby-forum.com/u/jruyle)\
**Post date:** [June 1, 2007, 6:07pm UTC](https://www.ruby-forum.com/t/that-problem-with-sessions-on-ie6/105708/4 "2007-06-01T18:07:34Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jruyle](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/d2c977/32.png) [@jruyle](https://www.ruby-forum.com/u/jruyle)\
**Post date:** [June 1, 2007, 7:49pm UTC](https://www.ruby-forum.com/t/that-problem-with-sessions-on-ie6/105708/5 "2007-06-01T19:49:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jruyle](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/d2c977/32.png) [@jruyle](https://www.ruby-forum.com/u/jruyle)\
**Post date:** [June 3, 2007, 11:05am UTC](https://www.ruby-forum.com/t/that-problem-with-sessions-on-ie6/105708/6 "2007-06-03T11:05:28Z")

</div>

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 wasn`t. 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 wasn`t IE that missed the session as I thought.

Maybe it can help you.  
Good luck.

Juanma
