No marshal_dump is defined for class Proc


#1

Hello ~

This problem has me puzzled. When users login to my rails app I have
the
session set up to be stored in the MySQL database for the app.
Intermittently, users will get the following error:

no marshal_dump is defined for class Proc
D:/apps/xampp/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/session/active_record_store.rb:81:in
dump' D:/apps/xampp/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/session/active_record_store.rb:81:inmarshal’
D:/apps/xampp/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/session/active_record_store.rb:133:in
marshal_data!' D:/apps/xampp/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/callbacks.rb:333:incallback’
D:/apps/xampp/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/callbacks.rb:330:in
callback' D:/apps/xampp/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/callbacks.rb:248:increate_or_update’
D:/apps/xampp/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/base.rb:1388:in
save_without_validation' D:/apps/xampp/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/validations.rb:724:insave_without_transactions’
D:/apps/xampp/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/transactions.rb:126:in
save' D:/apps/xampp/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/connection_adapters/abstract/database_statements.rb:51:intransaction’
D:/apps/xampp/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/transactions.rb:91:in
transaction' D:/apps/xampp/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/transactions.rb:118:intransaction’
D:/apps/xampp/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/transactions.rb:126:in
save' D:/apps/xampp/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/session/active_record_store.rb:307:inupdate’
D:/apps/xampp/ruby/lib/ruby/gems/1.8/gems/activerecord-1.14.0/lib/active_record/base.rb:794:in
silence' D:/apps/xampp/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/session/active_record_store.rb:307:inupdate’
D:/apps/xampp/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/session/active_record_store.rb:314:in
close' D:/apps/xampp/ruby/lib/ruby/1.8/cgi/session.rb:330:inclose’
D:/apps/xampp/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/base.rb:982:in
close_session' D:/apps/xampp/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/base.rb:1024:inprocess_cleanup_without_flash’
D:/apps/xampp/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/flash.rb:147:in
process_cleanup_without_filters' D:/apps/xampp/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/filters.rb:426:inprocess_cleanup_without_session_management_support’
D:/apps/xampp/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/session_management.rb:126:in
process_cleanup_without_components' D:/apps/xampp/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/components.rb:182:inprocess_cleanup’
D:/apps/xampp/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/base.rb:383:in
process_without_filters' D:/apps/xampp/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/filters.rb:364:inprocess_without_session_management_support’
D:/apps/xampp/ruby/lib/ruby/gems/1.8/gems/actionpack-1.12.0/lib/action_controller/session_management.rb:117:in
process' D:/apps/xampp/ruby/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/dispatcher.rb:38:indispatch’
D:/apps/xampp/ruby/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/fcgi_handler.rb:150:in
process_request' D:/apps/xampp/ruby/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/fcgi_handler.rb:54:inprocess!’
D:/apps/xampp/ruby/lib/ruby/site_ruby/1.8/fcgi.rb:598:in each_cgi' D:/apps/xampp/ruby/lib/ruby/site_ruby/1.8/fcgi.rb:595:ineach_cgi’
D:/apps/xampp/ruby/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/fcgi_handler.rb:53:in
process!' D:/apps/xampp/ruby/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/fcgi_handler.rb:23:inprocess!’
D:/Data/web/remw/advocate/public/dispatch.fcgi:24

I have had this happen in Windows running in development mode and on
Linux
running in production. Any ideas or potential pointers would be greatly
appreciated.

Thx,

Ben


#2

Ben-

You cannot marshal objects that have procs or lambdas in them. Its a

current limitation of the ruby interpreter. What exactly are you
storing in the session? Whole objects? Or just id’s? SHow me what you
are storing in the session and I can help you figure it out.

CHeers-
-Ezra


#3

Hi Ezra ~

Thx for the tip. I was storing an entire object, but after much
consideration decided it was overkill and a potential security risk to
store
the object in the session. I adjusted my app to only store some key
elements in the session, and voila!

Thx again,

Ben