# Update to Rails session problem

**URL:** <https://www.ruby-forum.com/t/update-to-rails-session-problem/111560>\
**Category:** Ruby\
**Created:** [August 8, 2007, 4:17pm UTC](https://www.ruby-forum.com/t/update-to-rails-session-problem/111560 "2007-08-08T16:17:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ronald\_braswell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/f9ae1b/32.png) [@ronald\_braswell](https://www.ruby-forum.com/u/ronald_braswell)\
**Post date:** [August 8, 2007, 4:17pm UTC](https://www.ruby-forum.com/t/update-to-rails-session-problem/111560/1 "2007-08-08T16:17:23Z")

</div>

Rails 1.2.3  
Ruby 1.8.6  
Mongrel 1.0.1  
Mongrel cluster 1.0.2 (using 2 instances)  
Apache 2.2.4  
RAILS\_ENV=production  
Solaris 10 (11/06)

Background: I have devloped an automated test system for the system  
which  
our group supports. It uses a terminal server to connect to the serial  
I/O  
on the  
system and uses a LAN connection to mount NFS shares on the target  
system,  
connect to the databases on the target system, etc. Employed on Solaris  
10  
X64,  
using Oracle 10g, Ruby, RoR (admin and control), & DRb (for supporting a  
publish/subscribe  
system used by the test executive, simulator and evaluator daemons).

I have run a sequence of tests using just one browser session.  
The sequence of tests alternates between two tests which I will  
call test1 and test2. On the 10th execution which should have been  
the 5th execution for test2, test1 was executed instead.

Below is a fragment of production.log and a fragment of  
test\_exec\_controller.rb  
showing that what should have been put into session[:sys\_test\_ids].

Why would this work most of the time but fail occasionally?

Could there be a problem at times with flushing the session objects to  
disk  
s.t. when the next test is run, the previous test’s id was still there?

Any additional troubleshooting suggestions?

# 

# annotated fragment of production.log with addresses elided

# 

# 

# get for the initial start page which contains two sortable, drag &

drop  
lists

# 

Processing TestExecController#start\_test\_run (for … at 2007-08-08  
08:23:14) [GET]  
Session ID: 03572c6b0c71beae829a12e89faebc8c  
Parameters: {“action”=\>“start\_test\_run”, “controller”=\>“test\_exec”}  
Rendering within layouts/application  
Rendering test\_exec/start\_test\_run  
Completed in 0.01097 (91 reqs/sec) | Rendering: 0.00769 (70%) | DB:  
0.00136(12%) | 200 OK [http://…]

# 

# AJAX calls to move test 44 to selected tests, 28 & 57 are still

available

# 

Processing TestExecController#update\_test\_run (for … at 2007-08-08  
08:23:25) [POST]  
Session ID: 03572c6b0c71beae829a12e89faebc8c  
Parameters: {“available\_tests”=\>[“28”, “57”],  
“action”=\>“update\_test\_run”,  
“controller”=\>“test\_exec”}  
Completed in 0.00244 (409 reqs/sec) | Rendering: 0.00006 (2%) | DB:  
0.00110(45%) | 200 OK [http://…]

Processing TestExecController#update\_test\_run (for … at 2007-08-08  
08:23:25) [POST]  
Session ID: 03572c6b0c71beae829a12e89faebc8c  
Parameters: {“selected\_tests”=\>[“44”], “action”=\>“update\_test\_run”,  
“controller”=\>“test\_exec”}  
Completed in 0.00222 (449 reqs/sec) | Rendering: 0.00006 (2%) | DB:  
0.00095(42%) | 200 OK [http://…]

# 

# action for the form to start the tests just selected

# 

# the ‘\*\*\*\*\*\*\*\* running tests 28’ should be ‘\*\*\*\*\*\*\*\* running tests 44’

# 

Processing TestExecController#start\_test\_run (for … at 2007-08-08  
08:23:26) [POST]  
Session ID: 03572c6b0c71beae829a12e89faebc8c  
Parameters: {“test\_run”=\>{“tag”=\>“fdio 5”}, “commit”=\>“START”,  
“iterations”=\>“1”, “action”=\>“start\_test\_run”,  
“controller”=\>“test\_exec”}  
\*\*\*\*\*\*\*\* running tests 28  
Redirected to http://…  
Completed in 0.01929 (51 reqs/sec) | DB: 0.00254 (13%) | 302 Found  
[http://…

class TestExecController \< ApplicationController

def start\_test\_run  
# don’t put @sys\_tests in request.get? in case @test\_run.save  
fails  
# and we go back into the start\_test\_run view  
@sys\_tests = SysTest.find(:all)  
if request.get?  
@test\_run = TestRun.new  
session[:sys\_tests\_ids] = []  
else  
@test\_run = TestRun.new(params[:test\_run])  
@test\_run.engineer = @me  
@test\_run.began\_at = Time.now  
if session[:sys\_test\_ids].nil? || session[:sys\_test\_ids].empty?  
@test\_run.errors.add\_to\_base( “You must select at least one  
test”)  
return  
end  
if @test\_run.save  
logger.info("\*\*\*\*\*\*\*\* running tests  
#{session[:sys\_test\_ids]}")  
@test\_exec.start\_test\_run :test\_run =\> @test\_run,  
:tests =\> session[:sys\_test\_ids],  
:iterations =\> params[:iterations]  
redirect\_to :action =\> :status  
end  
end  
end

…

# 

# This method is the result of an AJAX call from the start test run

page

# when the contents of the ‘Selected Tests’ or Available Tests’ lists

are  
modified.

# 

def update\_test\_run  
session[:sys\_test\_ids] = params[:selected\_tests] if  
params[:selected\_tests]  
render :nothing =\> true  
end

…

end

---

<div class="post-metadata">

**Author:** ![ronald\_braswell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/f9ae1b/32.png) [@ronald\_braswell](https://www.ruby-forum.com/u/ronald_braswell)\
**Post date:** [August 8, 2007, 6:18pm UTC](https://www.ruby-forum.com/t/update-to-rails-session-problem/111560/2 "2007-08-08T18:18:05Z")

</div>

It seems nobody answered. You might have better luck at rails forum,

[http://groups.google.com/group/rubyonrails-talk](http://groups.google.com/group/rubyonrails-talk)

as you’ll find more people working with rails there.

J.
