Issue Details (XML | Word | Printable)

Key: JRUBY_RACK-10
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Blocker Blocker
Assignee: Nick Sieger
Reporter: milep
Votes: 0
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
jruby-rack

multipart form submit fails

Created: 03/Jun/09 02:44 PM   Updated: 20/Aug/09 10:15 PM   Resolved: 20/Aug/09 10:15 PM
Component/s: None
Affects Version/s: 0.9.5
Fix Version/s: 0.9.5

Time Tracking:
Not Specified

Environment:

Tomcat 6.0.18, JRuby 1.3RC2, jruby-rack 0.9.5(2009-06-01)


Tags:


 Description  « Hide

When I try to upload file with multipart form I get this error in Tomcat:

/!\ FAILSAFE /!\  Wed Jun 03 16:56:47 +0300 2009
  Status: 500 Internal Server Error
  bad content body
    /Applications/apache-tomcat-6.0.18/webapps/ROOT/WEB-INF/gems/gems/actionpack-2.3.2/lib/action_controller/vendor/rack-1.0/rack/utils.rb:343:in `parse_multipart'
    /Applications/apache-tomcat-6.0.18/webapps/ROOT/WEB-INF/gems/gems/actionpack-2.3.2/lib/action_controller/vendor/rack-1.0/rack/utils.rb:315:in `loop'
    /Applications/apache-tomcat-6.0.18/webapps/ROOT/WEB-INF/gems/gems/actionpack-2.3.2/lib/action_controller/vendor/rack-1.0/rack/utils.rb:315:in `parse_multipart'
    /Applications/apache-tomcat-6.0.18/webapps/ROOT/WEB-INF/gems/gems/actionpack-2.3.2/lib/action_controller/vendor/rack-1.0/rack/request.rb:124:in `POST'
    /Applications/apache-tomcat-6.0.18/webapps/ROOT/WEB-INF/gems/gems/actionpack-2.3.2/lib/action_controller/vendor/rack-1.0/rack/methodoverride.rb:15:in `call'
    /Applications/apache-tomcat-6.0.18/webapps/ROOT/WEB-INF/gems/gems/actionpack-2.3.2/lib/action_controller/params_parser.rb:15:in `call'
    /Applications/apache-tomcat-6.0.18/webapps/ROOT/WEB-INF/gems/gems/actionpack-2.3.2/lib/action_controller/rewindable_input.rb:25:in `call'
    /Applications/apache-tomcat-6.0.18/webapps/ROOT/WEB-INF/gems/gems/actionpack-2.3.2/lib/action_controller/session/abstract_store.rb:122:in `call'
    /Applications/apache-tomcat-6.0.18/webapps/ROOT/WEB-INF/gems/gems/activerecord-2.3.2/lib/active_record/query_cache.rb:29:in `call'
    /Applications/apache-tomcat-6.0.18/webapps/ROOT/WEB-INF/gems/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache'
    /Applications/apache-tomcat-6.0.18/webapps/ROOT/WEB-INF/gems/gems/activerecord-2.3.2/lib/active_record/query_cache.rb:9:in `cache'
    /Applications/apache-tomcat-6.0.18/webapps/ROOT/WEB-INF/gems/gems/activerecord-2.3.2/lib/active_record/query_cache.rb:28:in `call'
    /Applications/apache-tomcat-6.0.18/webapps/ROOT/WEB-INF/gems/gems/activerecord-2.3.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in `call'
    /Applications/apache-tomcat-6.0.18/webapps/ROOT/WEB-INF/gems/gems/actionpack-2.3.2/lib/action_controller/failsafe.rb:11:in `call'
    /Applications/apache-tomcat-6.0.18/webapps/ROOT/WEB-INF/gems/gems/actionpack-2.3.2/lib/action_controller/vendor/rack-1.0/rack/lock.rb:11:in `call'
    /Applications/apache-tomcat-6.0.18/webapps/ROOT/WEB-INF/gems/gems/actionpack-2.3.2/lib/action_controller/dispatcher.rb:106:in `call'
    file:/Applications/apache-tomcat-6.0.18/webapps/ROOT/WEB-INF/lib/jruby-rack-0.9.5-SNAPSHOT.jar!/rack/adapter/rails.rb:35:in `serve_rails'
    file:/Applications/apache-tomcat-6.0.18/webapps/ROOT/WEB-INF/lib/jruby-rack-0.9.5-SNAPSHOT.jar!/rack/adapter/rails.rb:40:in `call'
    file:/Applications/apache-tomcat-6.0.18/webapps/ROOT/WEB-INF/lib/jruby-rack-0.9.5-SNAPSHOT.jar!/jruby/rack/rails.rb:144:in `call'
    file:/Applications/apache-tomcat-6.0.18/webapps/ROOT/WEB-INF/lib/jruby-rack-0.9.5-SNAPSHOT.jar!/rack/handler/servlet.rb:17:in `call'
    :1

But it works with jruby & webrick.



milep added a comment - 03/Jun/09 06:33 PM

Found out that this happens only in our production server (debian, java 1.6.0_10), but not on OS X (10.5.7, java 1.6.0_07).
I used the same war file and the same version of the tomcat on both machines, but it could be problem with my environmet. Any pointers would be welcome...


milep added a comment - 04/Jun/09 10:55 AM

I made a small rails app to test this:

new.html.erb
<% form_tag 'create', :multipart => true, :method => :post do %>
  Upload file: <%= file_field_tag 'uploaded_data' %>
  <br />
  <%= submit_tag( "Upload file" ) %>
<% end %>
upload_controller.rb
class UploadController < ApplicationController
  def new
  end

  def create
    ud = params[:uploaded_data]
    send_data(
      ud.read,
      :type => ud.content_type,
      :filename => File.basename(ud.original_filename),
      :disposition => 'inline'
    )
  end
end

With debian, glassfishv3-prelude server, jruby 1.3.0 symbolic link in glassfish/modules/jruby and application deployed as directory it works. But with the same server deployed as war, it fails(same bad contet body error) when submitting the form.


Jay Kaluza added a comment - 30/Jun/09 04:53 PM

We've been attempting to upgrade all our apps to Rails-2.3.2 and got hit with this too.

Apache Tomcat/6.0.18
Jruby-1.3.1
Warbler-0.9.13
latest jruby-rack as of Jun 30

The patch on this fork seems to do the trick, but I'm not sure if there are other similar fixes needed.
http://github.com/lenny/jruby-rack/tree/master

I have a skeletal app to reproduce which I can add to my fork if necessary. The bug does not show reliably, but it can be produced frequently. We were primarily seeing with Safari-3.2.3 and possibly newer versions of Safari. Doesn't seem to happen(at least often) with FF.


Nick Sieger added a comment - 20/Aug/09 10:15 PM

Michael Pitman encountered this problem as well. Fix is in f5ee0d9.