Very strange error when storing a date value in rails session


#1

Hi all,

I’ve run into a very strange error and was wondering if anyone out
there could give me a hand…

I’ve been able to reproduce the error consistently now and still, it
seems that I am completely missing where/why it could be happening.

I have a rails controller with a method here:

class TimeAssignController < ApplicationController

def index
@current_date = get_current_date
end

private
def get_current_date
if session[:time_assign_current_date] == nil
session[:time_assign_current_date] = Time.new
end
return session[:time_assign_current_date]
end

end

That’s it. Now, this problem was not happening when I was on rails 2.1
and jruby 1.1.4, it started happening once I migrated to rails 2.2.2
and jruby1.1.5. When I access this page the first time, everything
runs fine and the session variable gets set with the current date. The
second time I access this page, however, I get this:

/!\ FAILSAFE /!\ Tue Dec 02 09:20:45 -0800 2008
Status: 500 Internal Server Error
End of file reached
C:/tools/java/jruby-1.1.5/lib/ruby/1.8/pstore.rb:354:in load' C:/tools/java/jruby-1.1.5/lib/ruby/1.8/pstore.rb:354:inload’
C:/tools/java/jruby-1.1.5/lib/ruby/1.8/pstore.rb:310:in
transaction' C:/tools/java/jruby-1.1.5/lib/ruby/1.8/cgi/session/pstore.rb:72:inrestore’
C:/tools/java/jruby-1.1.5/lib/ruby/1.8/cgi/session.rb:304:in []' C:/development/acp/vendor/rails/actionpack/lib/action_controller/cgi_process.rb:98:insession’
C:/development/acp/vendor/rails/actionpack/lib/action_controller/cgi_process.rb:130:in
stale_session_check!' C:/development/acp/vendor/rails/actionpack/lib/action_controller/cgi_process.rb:78:insession’
C:/development/acp/vendor/rails/actionpack/lib/action_controller/base.rb:1205:in
assign_shortcuts' C:/development/acp/vendor/rails/actionpack/lib/action_controller/flash.rb:166:inassign_shortcuts_with_flash’
C:/development/acp/vendor/rails/actionpack/lib/action_controller/base.rb:519:in
process' C:/development/acp/vendor/rails/actionpack/lib/action_controller/filters.rb:606:inprocess_with_filters’
C:/development/acp/vendor/rails/actionpack/lib/action_controller/session_management.rb:134:in
process_with_session_management_support' C:/development/acp/vendor/rails/actionpack/lib/action_controller/base.rb:392:inprocess’
C:/development/acp/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:183:in
handle_request' C:/development/acp/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:110:indispatch_unlocked’
C:/development/acp/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:123:in
dispatch' C:/development/acp/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:122:indispatch’
C:/development/acp/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:132:in
dispatch_cgi' C:/development/acp/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:39:indispatch’
C:/development/acp/vendor/rails/railties/lib/webrick_server.rb:103:in
handle_dispatch' C:/development/acp/vendor/rails/railties/lib/webrick_server.rb:74:inservice’
C:/tools/java/jruby-1.1.5/lib/ruby/1.8/webrick/httpserver.rb:104:in
service' C:/tools/java/jruby-1.1.5/lib/ruby/1.8/webrick/httpserver.rb:65:inrun’
C:/tools/java/jruby-1.1.5/lib/ruby/1.8/webrick/server.rb:173:in
start_thread' :1:instart’

Switching to active_record_store, p_store, and cookie store all show
the same problem. It also happens on WEBrick and tomcat. I have no
idea what is going on, any ideas? I am totally stuck on this one and
any help would be much much appreciated.

Thank you very much,
Jin


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

#2

I guess this is kind of redundant, but for those who like to browse, the
JRuby cookbook just made it to my local bookstore.

Looks like Justin & Henry did a good job, although there are a few
things I do wish they had included.


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email