Forum: JRuby very strange error when storing a date value in rails session

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Jin L. (Guest)
on 2008-12-02 20:23
(Received via mailing list)
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:in `load'
    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:in
`restore'
    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:in
`session'
    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:in
`session'
    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:in
`assign_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:in
`process_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:in
`process'
    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:in
`dispatch_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:in
`dispatch'
    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:in
`dispatch'
    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:in
`service'
    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:in
`run'
    C:/tools/java/jruby-1.1.5/lib/ruby/1.8/webrick/server.rb:173:in
`start_thread'
    :1:in `start'

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
john casu (Guest)
on 2008-12-02 22:07
(Received via mailing list)
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
This topic is locked and can not be replied to.