Session overflows, maybe mod_rails related?

Hi all,

I’m constantly getting session overflow errors in my app. It seems to
be somewhat random and I have trouble reproducing it on a consistent
basis. Basically, every once in a while, it throws the error and
renders the 500 internal server page. When I hit refresh however, it
usually goes away. This seems to happen more often when server load is
high.

My setup is mod_rails, Rails 2.0.2, and ActiveRecord session store in
MySQL. I’ve never seen this error on my development box, which just
runs the app with a mongrel so it makes me think it might be related
to mod_rails – but then again, the error happens somewhat randomly
and is correlated with heavy server load, so I could be wrong.

Here’s the full error text:

Rendering /home/admin/deployed/cebturf/releases/20080502063852/public/
500.html (500 Internal Server Error)
/!\ FAILSAFE /!\ Sat May 03 01:20:46 +0000 2008
Status: 500 Internal Server Error
You have a nil object when you didn’t expect it!
The error occurred while evaluating nil.limit
/usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/
session/active_record_store.rb:74:in data_column_size_limit' /usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/ session/active_record_store.rb:144:inraise_on_session_data_overflow!’
/usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/
callbacks.rb:307:in send' /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/ callbacks.rb:307:incallback’
/usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/
callbacks.rb:304:in each' /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/ callbacks.rb:304:incallback’
/usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/
callbacks.rb:212:in create_or_update' /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/ base.rb:1972:insave_without_validation’
/usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/
validations.rb:934:in save_without_transactions' /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/ transactions.rb:108:insave’
/usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/
connection_adapters/abstract/database_statements.rb:66:in
transaction' /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/ transactions.rb:80:intransaction’
/usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/
transactions.rb:100:in transaction' /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/ transactions.rb:108:insave’
/usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/
transactions.rb:120:in rollback_active_record_state!' /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/ transactions.rb:108:insave’
/usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/
session/active_record_store.rb:310:in update' /usr/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/ base.rb:1198:insilence’
/usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/
session/active_record_store.rb:310:in update' /usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/ session/active_record_store.rb:317:inclose’
/usr/lib/ruby/1.8/cgi/session.rb:324:in close' /usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/ base.rb:1247:inclose_session’
/usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/
base.rb:1292:in process_cleanup_without_flash' /usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/ flash.rb:173:inprocess_cleanup_without_session_management_support’
/usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/
session_management.rb:133:in process_cleanup_without_components' /usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/ components.rb:161:inprocess_cleanup’
/usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/
base.rb:532:in process_without_filters' /usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/ filters.rb:685:inprocess_without_session_management_support’
/usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/
session_management.rb:123:in process' /usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/ base.rb:388:inprocess’
/usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/
dispatcher.rb:171:in handle_request' /usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/ dispatcher.rb:115:indispatch’
/usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/
dispatcher.rb:126:in dispatch_cgi' /usr/lib/ruby/gems/1.8/gems/actionpack-2.0.2/lib/action_controller/ dispatcher.rb:9:indispatch’
/usr/lib/ruby/gems/1.8/gems/passenger-1.0.1/lib/passenger/
request_handler.rb:295:in process_request' /usr/lib/ruby/gems/1.8/gems/passenger-1.0.1/lib/passenger/ request_handler.rb:175:inmain_loop’
/usr/lib/ruby/gems/1.8/gems/passenger-1.0.1/lib/passenger/
application_spawner.rb:286:in start_request_handler' /usr/lib/ruby/gems/1.8/gems/passenger-1.0.1/lib/passenger/ application_spawner.rb:255:inhandle_spawn_application’
/usr/lib/ruby/gems/1.8/gems/passenger-1.0.1/lib/passenger/
application_spawner.rb:253:in fork' /usr/lib/ruby/gems/1.8/gems/passenger-1.0.1/lib/passenger/ application_spawner.rb:253:inhandle_spawn_application’
/usr/lib/ruby/gems/1.8/gems/passenger-1.0.1/lib/passenger/
application_spawner.rb:251:in fork' /usr/lib/ruby/gems/1.8/gems/passenger-1.0.1/lib/passenger/ application_spawner.rb:251:inhandle_spawn_application’
/usr/lib/ruby/gems/1.8/gems/passenger-1.0.1/lib/passenger/
abstract_server.rb:291:in __send__' /usr/lib/ruby/gems/1.8/gems/passenger-1.0.1/lib/passenger/ abstract_server.rb:291:inmain_loop’
/usr/lib/ruby/gems/1.8/gems/passenger-1.0.1/lib/passenger/
abstract_server.rb:147:in start_synchronously' /usr/lib/ruby/gems/1.8/gems/passenger-1.0.1/lib/passenger/ abstract_server.rb:114:instart’
/usr/lib/ruby/gems/1.8/gems/passenger-1.0.1/lib/passenger/
abstract_server.rb:108:in fork' /usr/lib/ruby/gems/1.8/gems/passenger-1.0.1/lib/passenger/ abstract_server.rb:108:instart’
/usr/lib/ruby/gems/1.8/gems/passenger-1.0.1/lib/passenger/
application_spawner.rb:147:in start' /usr/lib/ruby/gems/1.8/gems/passenger-1.0.1/lib/passenger/ framework_spawner.rb:278:inhandle_spawn_application’
/usr/lib/ruby/gems/1.8/gems/passenger-1.0.1/lib/passenger/
framework_spawner.rb:273:in synchronize' /usr/lib/ruby/gems/1.8/gems/passenger-1.0.1/lib/passenger/ framework_spawner.rb:273:inhandle_spawn_application’
/usr/lib/ruby/gems/1.8/gems/passenger-1.0.1/lib/passenger/
abstract_server.rb:291:in __send__' /usr/lib/ruby/gems/1.8/gems/passenger-1.0.1/lib/passenger/ abstract_server.rb:291:inmain_loop’
/usr/lib/ruby/gems/1.8/gems/passenger-1.0.1/lib/passenger/
abstract_server.rb:147:in start_synchronously' /usr/lib/ruby/gems/1.8/gems/passenger-1.0.1/lib/passenger/ abstract_server.rb:114:instart’
/usr/lib/ruby/gems/1.8/gems/passenger-1.0.1/lib/passenger/
abstract_server.rb:108:in fork' /usr/lib/ruby/gems/1.8/gems/passenger-1.0.1/lib/passenger/ abstract_server.rb:108:instart’
/usr/lib/ruby/gems/1.8/gems/passenger-1.0.1/lib/passenger/
framework_spawner.rb:104:in start' /usr/lib/ruby/gems/1.8/gems/passenger-1.0.1/lib/passenger/ spawn_manager.rb:106:inspawn_application’
/usr/lib/ruby/gems/1.8/gems/passenger-1.0.1/lib/passenger/
spawn_manager.rb:102:in synchronize' /usr/lib/ruby/gems/1.8/gems/passenger-1.0.1/lib/passenger/ spawn_manager.rb:102:inspawn_application’
/usr/lib/ruby/gems/1.8/gems/passenger-1.0.1/lib/passenger/
spawn_manager.rb:178:in handle_spawn_application' /usr/lib/ruby/gems/1.8/gems/passenger-1.0.1/lib/passenger/ abstract_server.rb:291:insend
/usr/lib/ruby/gems/1.8/gems/passenger-1.0.1/lib/passenger/
abstract_server.rb:291:in main_loop' /usr/lib/ruby/gems/1.8/gems/passenger-1.0.1/lib/passenger/ abstract_server.rb:147:instart_synchronously’
/usr/lib/ruby/gems/1.8/gems/passenger-1.0.1/bin/passenger-spawn-
server:32

Thoughts?

– Andrew

Also, to elaborate, I’m not sticking anything huge in the sessions,
just things like session[:user_id] = 123 and session[:last_uri] = /
some/path.

– Andrew

On 4 May 2008, at 00:54, Andrew F. wrote:

Also, to elaborate, I’m not sticking anything huge in the sessions,
just things like session[:user_id] = 123 and session[:last_uri] = /
some/path.

Are you sticking loads of stuff in the flash (since that it stored in
the session too)

Fred

If you trace the error down far enough, it looks likes it’s being
raised from the passenger gem. So I’d email them.

Nope. Just stuff in flash[:notice], none of which exceeds 128
characters.

On a related note, no similar error seems to appear when use memcached
session store instead of active record.

– Andrew

On May 4, 4:50 am, Frederick C. [email protected]