ArgumentError: dump format error() when unmarshalling Rails session and 
EOFError when unmarshalling hash with containing value of type 
ActionController::Flash::FlashHash
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------

                 Key: JRUBY-3289
                 URL: http://jira.codehaus.org/browse/JRUBY-3289
             Project: JRuby
          Issue Type: Bug
          Components: Core Classes/Modules
    Affects Versions: JRuby 1.1.6
         Environment: OSX 10.5.6, Rails 1.2.3, Rails 2.2.2, MRI 1.8.5
            Reporter: Russ Rollins
         Attachments: jruby_marshal_flashhash_test.rb

In an attempt to port a Rails 1.2.3 application to JRuby I encountered this 
message when the session was unmarshalled:
{noformat}
ArgumentError: dump format error()
{noformat}

Here's a simple test case that produces the same result, though with a 
different error thrown:
{code}
rails_flash =  ActionController::Flash::FlashHash.new
test_hash = {:flash =>rails_flash, :date => Date.today}
dump_test = Marshal.dump(test_hash)
loaded = Marshal.load(dump_test)
{code}
As opposed to a normal Hash which executes as expected:
{code}
normal_hash = Hash.new
test_hash = {:normal => normal_hash, :date => Date.today}
dump_test = Marshal.dump(test_hash)
loaded = Marshal.load(dump_test)
{code}
I've executed in Rails 1.2.3 and Rails 2.2.2 via the console, they both fail. 
However, these work flawlessly when invoked with MRI 1.8.5. See attached test 
case.

h4. UnmarshalStream Findings
Here's the marshalled string:
{code}
"\004\b{\a:\nflashIC:'ActionController::Flash::FlashHash{\000\006:\...@used{\000:\tdateu:\tDate=\004\b[\bo:\rRational\a:\...@denominatori\a:\...@numeratori\003k?ji\000i\003\031\025#"
{code}

I downloaded the JRuby source and think I have identified the problem in 
UnmarshalStream. I've stepped through the JRuby code multiple times now and 
have a grasp on the cause of the failure, but I don't have a patch. When the 
ActionController::Flash::FlashHash instance is being unmarshalled  in 
unmarshalObjectDirectly, isvarsWaiting is set to true (due to the I from the 
marshalled FlashHash) and, as far as these tests go, is never reset to false. 
In the session unmarshalling case, when the Date object is parsed and the \031 
character is read, it fails the switch case and the ArgumentError is raised. In 
the provided test case, 


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to