# How to debug session error

**URL:** <https://discuss.rubyonrails.org/t/how-to-debug-session-error/25278>\
**Category:** rubyonrails-talk\
**Created:** [February 21, 2008, 11:32pm UTC](https://discuss.rubyonrails.org/t/how-to-debug-session-error/25278 "2008-02-21T23:32:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![11175](https://avatars.discourse-cdn.com/v4/letter/1/8edcca/32.png) [@11175](https://discuss.rubyonrails.org/u/11175)\
**Post date:** [February 21, 2008, 11:32pm UTC](https://discuss.rubyonrails.org/t/how-to-debug-session-error/25278/1 "2008-02-21T23:32:51Z")

</div>

My rails (1.1.6) wep application has been working fine for months, with 15 000 user per day. never had any problem with session.

Then I added a new feature to my app, and, after 4 to 6 hours, sessions start to be lost. I mean, i set a session["a"] = stuff, at the next call, session["a"] will be nil !!! So my user can not login...because of the session["user\_id"]

If i restart my application, it works fine for an extra 4 to 6 hour.

If i rollback my application to before the new feature, it works fine.

here is my new feature:

begin &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;timeout(15) do &nbsp;&nbsp;&nbsp;&nbsp;puts system( EXECUTE AN OPENOFFICE MACRO ) &nbsp;&nbsp;end rescue Timeout::Error =\> err &nbsp;&nbsp;log rescue Exception =\> err &nbsp;&nbsp;log end

So the new feature is to upload user file, and handle then with an openoffice macro with a system command...

Sometime, the command fail...

Could it be possible that this command have some impact on the rails session managment system ?

My session are stored in a Mysql DB.

Please help, any clue are welcome

---

<div class="post-metadata">

**Author:** ![Frederick\_Cheung](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/frederick_cheung/32/3901_2.png) [@Frederick\_Cheung](https://discuss.rubyonrails.org/u/Frederick_Cheung)\
**Post date:** [February 22, 2008, 10:23am UTC](https://discuss.rubyonrails.org/t/how-to-debug-session-error/25278/2 "2008-02-22T10:23:05Z")

</div>

> My rails (1.1.6) wep application has been working fine for months,  
> with 15 000 user per day. never had any problem with session.
> 
> Then I added a new feature to my app, and, after 4 to 6 hours,  
> sessions start to be lost. I mean, i set a session["a"] = stuff, at the next call, session["a"] will be nil !!! So my user can not login...because of the session["user\_id"]
> 
> If i restart my application, it works fine for an extra 4 to 6 hour.
> 
> If i rollback my application to before the new feature, it works fine.
> 
> here is my new feature:
> 
> begin &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;timeout(15) do &nbsp;&nbsp;&nbsp;puts system( EXECUTE AN OPENOFFICE MACRO ) end rescue Timeout::Error =\> err log rescue Exception =\> err log end

You may be running into the problem I wrote about here: [钛刻专家——官网](http://www.texperts.com/2007/05/01/race-conditions-in-rails-sessions-and-how-to-fix-them/)

Short version: because you've got such a long running action, it is  
very likely that you'll get concurrent requests from the same user and  
the different updates to the session overwrite each other.

Fred
