Problem uploading large files with rails


#1

Hello all…

I am having trouble uploading large files in my rails application. I am using rails version 2.2.2. Upload processing is being handled by Paperclip. The site is running on Passenger.

I have set up a basic upload form setup. I can upload small files (anything under 70mb). If I try to upload a large file, I get a 500 error. The log file says:

/!\ FAILSAFE /!\ Mon Jul 20 15:35:14 -0700 2009
Status: 500 Internal Server Error
no content body
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/request.rb:653:in read_multipart' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/request.rb:581:inparse_multipart_form_parameters’
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/request.rb:511:in parse_formatted_request_parameters' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/request.rb:441:inrequest_parameters’
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/request.rb:392:in parameters' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/session_management.rb:139:inset_session_options_without_components’
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/components.rb:161:in set_session_options' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/session_management.rb:133:inprocess’
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/base.rb:392:in process' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:183:inhandle_request’
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:110:in dispatch_unlocked' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:123:indispatch’
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:122:in synchronize' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:122:indispatch’
/usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:132:in dispatch_cgi' /usr/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/dispatcher.rb:39:indispatch’
/dh/passenger/lib/phusion_passenger/railz/request_handler.rb:45:in process_request' /dh/passenger/lib/phusion_passenger/abstract_request_handler.rb:203:inmain_loop’
/dh/passenger/lib/phusion_passenger/railz/application_spawner.rb:340:in start_request_handler' /dh/passenger/lib/phusion_passenger/railz/application_spawner.rb:298:inhandle_spawn_application’
/dh/passenger/lib/phusion_passenger/utils.rb:181:in safe_fork' /dh/passenger/lib/phusion_passenger/railz/application_spawner.rb:296:inhandle_spawn_application’
/dh/passenger/lib/phusion_passenger/abstract_server.rb:337:in __send__' /dh/passenger/lib/phusion_passenger/abstract_server.rb:337:inmain_loop’
/dh/passenger/lib/phusion_passenger/abstract_server.rb:187:in start_synchronously' /dh/passenger/lib/phusion_passenger/abstract_server.rb:154:instart’
/dh/passenger/lib/phusion_passenger/railz/application_spawner.rb:192:in start' /dh/passenger/lib/phusion_passenger/spawn_manager.rb:257:inspawn_rails_application’
/dh/passenger/lib/phusion_passenger/abstract_server_collection.rb:126:in lookup_or_add' /dh/passenger/lib/phusion_passenger/spawn_manager.rb:251:inspawn_rails_application’
/dh/passenger/lib/phusion_passenger/abstract_server_collection.rb:80:in synchronize' /dh/passenger/lib/phusion_passenger/abstract_server_collection.rb:79:insynchronize’
/dh/passenger/lib/phusion_passenger/spawn_manager.rb:250:in spawn_rails_application' /dh/passenger/lib/phusion_passenger/spawn_manager.rb:153:inspawn_application’
/dh/passenger/lib/phusion_passenger/spawn_manager.rb:282:in handle_spawn_application' /dh/passenger/lib/phusion_passenger/abstract_server.rb:337:insend
/dh/passenger/lib/phusion_passenger/abstract_server.rb:337:in main_loop' /dh/passenger/lib/phusion_passenger/abstract_server.rb:187:instart_synchronously’
/dh/passenger/bin/passenger-spawn-server:55

It never reaches my controller to do the actual processing of the uploaded file so I’m thinking this is an apache issue. Has anyone else run into this? Is there a workaround?

Thank you in advance for any insight.

Marc


#2

Generally you shouldn’t use HTTP-upload on large files.

On your own server you can change settings on size and timelimits to whatever you want, but you can’t on a shared webserver.

It may well be that 70MB is the limit with the current settings - I don’t know.