Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Rack in Rails 2.3.2 throws fatal error with small uploads

#2497

We have found a specific situation with binary multipart uploads causing Rack with Rails 2.3.2 to throw a fatal error.

The specific files we have tested shows that >= 112kb works, <= 110k fails. The error thrown up from Rack is:

/!\ FAILSAFE /!\ 2009-04-14 17:23:32 -0400 Status: 500 Internal Server Error invalid byte sequence in US-ASCII

/usr/playerconnect-stack-2009c/lib/ruby/gems/1.9.1/gems/actionpack-2.3.2/lib/action_controller/vendor/rack-1.0/rack/utils.rb:320:in `=~'
/usr/playerconnect-stack-2009c/lib/ruby/gems/1.9.1/gems/actionpack-2.3.2/lib/action_controller/vendor/rack-1.0/rack/utils.rb:320:in `block in parse_multipart'
/usr/playerconnect-stack-2009c/lib/ruby/gems/1.9.1/gems/actionpack-2.3.2/lib/action_controller/vendor/rack-1.0/rack/utils.rb:315:in `loop'
/usr/playerconnect-stack-2009c/lib/ruby/gems/1.9.1/gems/actionpack-2.3.2/lib/action_controller/vendor/rack-1.0/rack/utils.rb:315:in `parse_multipart'
/usr/playerconnect-stack-2009c/lib/ruby/gems/1.9.1/gems/actionpack-2.3.2/lib/action_controller/vendor/rack-1.0/rack/request.rb:125:in `POST'
/usr/playerconnect-stack-2009c/lib/ruby/gems/1.9.1/gems/actionpack-2.3.2/lib/action_controller/vendor/rack-1.0/rack/methodoverride.rb:15:in `call'
/usr/playerconnect-stack-2009c/lib/ruby/gems/1.9.1/gems/actionpack-2.3.2/lib/action_controller/params_parser.rb:15:in `call'
/usr/playerconnect-stack-2009c/lib/ruby/gems/1.9.1/gems/actionpack-2.3.2/lib/action_controller/rewindable_input.rb:25:in `call'
/usr/playerconnect-stack-2009c/lib/ruby/gems/1.9.1/gems/actionpack-2.3.2/lib/action_controller/session/abstract_store.rb:122:in `call'
/usr/playerconnect-stack-2009c/lib/ruby/gems/1.9.1/gems/actionpack-2.3.2/lib/action_controller/failsafe.rb:11:in `call'
/usr/playerconnect-stack-2009c/lib/ruby/gems/1.9.1/gems/actionpack-2.3.2/lib/action_controller/vendor/rack-1.0/rack/lock.rb:11:in `block in call'
<internal:prelude>:8:in `synchronize'
/usr/playerconnect-stack-2009c/lib/ruby/gems/1.9.1/gems/actionpack-2.3.2/lib/action_controller/vendor/rack-1.0/rack/lock.rb:11:in `call'
/usr/playerconnect-stack-2009c/lib/ruby/gems/1.9.1/gems/actionpack-2.3.2/lib/action_controller/dispatcher.rb:106:in `call'
/usr/playerconnect-stack-2009c/lib/ruby/gems/1.9.1/gems/actionpack-2.3.2/lib/action_controller/cgi_process.rb:44:in `dispatch_cgi'
/usr/playerconnect-stack-2009c/lib/ruby/gems/1.9.1/gems/actionpack-2.3.2/lib/action_controller/dispatcher.rb:102:in `dispatch_cgi'
/usr/playerconnect-stack-2009c/lib/ruby/gems/1.9.1/gems/actionpack-2.3.2/lib/action_controller/dispatcher.rb:28:in `dispatch'
/usr/playerconnect-stack-2009c/lib/ruby/gems/1.9.1/gems/thin-1.0.0/lib/rack/adapter/rails.rb:54:in `serve_rails'
/usr/playerconnect-stack-2009c/lib/ruby/gems/1.9.1/gems/thin-1.0.0/lib/rack/adapter/rails.rb:74:in `call'
/usr/playerconnect-stack-2009c/lib/ruby/gems/1.9.1/gems/thin-1.0.0/lib/thin/connection.rb:63:in `pre_process'
/usr/playerconnect-stack-2009c/lib/ruby/gems/1.9.1/gems/thin-1.0.0/lib/thin/connection.rb:54:in `process'
/usr/playerconnect-stack-2009c/lib/ruby/gems/1.9.1/gems/thin-1.0.0/lib/thin/connection.rb:39:in `receive_data'
/usr/playerconnect-stack-2009c/lib/ruby/gems/1.9.1/gems/eventmachine-0.12.6/lib/eventmachine.rb:240:in `run_machine'
/usr/playerconnect-stack-2009c/lib/ruby/gems/1.9.1/gems/eventmachine-0.12.6/lib/eventmachine.rb:240:in `run'
/usr/playerconnect-stack-2009c/lib/ruby/gems/1.9.1/gems/thin-1.0.0/lib/thin/backends/base.rb:57:in `start'
/usr/playerconnect-stack-2009c/lib/ruby/gems/1.9.1/gems/thin-1.0.0/lib/thin/server.rb:150:in `start'
/usr/playerconnect-stack-2009c/lib/ruby/gems/1.9.1/gems/thin-1.0.0/lib/thin/controllers/controller.rb:80:in `start'
/usr/playerconnect-stack-2009c/lib/ruby/gems/1.9.1/gems/thin-1.0.0/lib/thin/runner.rb:173:in `run_command'
/usr/playerconnect-stack-2009c/lib/ruby/gems/1.9.1/gems/thin-1.0.0/lib/thin/runner.rb:139:in `run!'
/usr/playerconnect-stack-2009c/lib/ruby/gems/1.9.1/gems/thin-1.0.0/bin/thin:6:in `<top (required)>'
/usr/playerconnect-stack-2009c/bin/thin:19:in `load'
/usr/playerconnect-stack-2009c/bin/thin:19:in `<main>'

I have also posted this to the Rack devel list, but this specific exception is coming from Rails' bundled rack-1.0 package. The attached file fails in our tests.

Any help is MUCH appreciated.

Thanks, Nate

Reported by Nate Wiger · April 15th, 2009 @ 12:38 AM

State: wontfix
Milestone: 2.x
Assigned to: nobody
Importance: none

Activity

  1. Marius Mathiesen
    Marius Mathiesen

    I'm having the same problem. Like Nate, this happens only in Ruby 1.9. I've confirmed the bug to be in both Ruby 1.9.1 and the trunk version of Ruby.

    April 15th, 2009 @ 12:56 PM

  2. Marius Mathiesen
    Marius Mathiesen

    This was due to a bug in Rack, which has now been resolved: http://github.com/rack/rack/comm...

    Patching Rack works in my case; as Rack is no longer bundled with Rails, this should help folks on newer Rails versions.

    April 30th, 2009 @ 01:45 PM

  3. Marius Mathiesen
    Marius Mathiesen
    • Tag changed from 2.3.2, actionpack, exception, failsafe, multipart, rack to 2.3.2, actionpack, exception, failsafe, multipart, patch, rack

    Attaching a patch for the 2.3.2 tag

    April 30th, 2009 @ 01:56 PM

  4. James Healy
    James Healy

    The patch doesn't seem to help on my system. I'm getting this error when I try to upload a UTF-8 text file via a form (only on ruby 1.9 obviously).

    July 18th, 2009 @ 06:30 AM

  5. James Healy
    James Healy

    Oh, my bad. I just had to apply the patch to the rack gem as well as the vendored copy in rails 2.3.2.

    Apologies for the noise!

    July 18th, 2009 @ 06:33 AM

  6. Prem Sichanugrist (sikachu)