Search code examples
ruby-on-railsuploadapache2passengermod-rails

Not able to upload in a passenger app behing apache


Am not able to upload a 8.4 MB file, in a passenger app behind apache. Transferring the same file via scp took 4.1 minutes.

Error backtrace:

[ pid=10222 file=ext/apache2/Hooks.cpp:727 time=2010-05-18 07:13:14.842 ]: Unexpected error in mod_passenger: An error occurred while receiving HTTP upload data: Connection reset by peer (104) Backtrace: in 'boost::shared_ptr Hooks::receiveRequestBody(request_rec*, const char*)' (Hooks.cpp: 1084) in 'int Hooks::handleRequest(request_rec*)' (Hooks.cpp:459)

NOTE:user had not cancelled or anything. He was on firefox :-)

other errors seen in the logs are:

  1. [ pid=16593 file=ext/apache2/Hooks.cpp:727 time=2010-05-23 23:06:12.156 ]: Unexpected error in mod_passenger: It looks like the browser did not finish the file upload: it said it will upload 6610086\ bytes, but it closed the connection after sending 610155 bytes. The user probably clicked Stop in the browser or his Interne\ t connection stalled. Backtrace: in 'boost::shared_ptr Hooks::receiveRequestBody(request_rec*, const char*)' (Hooks.cpp: 1084) in 'int Hooks::handleRequest(request_rec*)' (Hooks.cpp: 459)

    NOTE:user had not cancelled or anything. He was on IE6 :-)

  2. [ pid=28995 file=ext/apache2/Hooks.cpp:727 time=2010-05-17 00:40:18.697 ]: Unexpected error in mod_passenger: Could not send data to the ApplicationPool server: write() failed: Broken pipe (32) Backtrace: in 'virtual boost::shared_ptr Passenger::ApplicationPoolServer::Client::get(const Passe\ nger::PoolOptions&)' (ApplicationPoolServer.h: 402) in 'int Hooks::handleRequest(request_rec*)' (Hooks.cpp: 523)

questions are:

  1. why is the file not getting uploaded?
  2. best practices for file upload in apache for throughput and performance.
  3. can i handle the upload outside of apache and then hand it off to passenger
  4. have also tried mod_porter, http://modporter.com, it does not seem to help.
  5. is there a debug mode in passenger - verbose logging

PS: Using RubyOnRails deployed with mod_rails on apache, http://www.modrails.com/, with ruby enterprise edition. TimeOut is set as 1200 in the apache virtalhost.

regards,
deepak


Solution

  • What if it takes 1200 seconds to upload 610155 bytes? That seems perfectly reasonable. HTTP transfers are usually not as aggressive as mechanisms like scp and can tend to drag a lot more since HTTP is not especially efficient at uploading.

    You can try opening up your timeout, if that has a direct effect on the situation, or remember that some clients may be connected via a firewall that, for whatever reason, limits connections to a maximum amount of time, often of around ten minutes.

    Can you replicate the problem from a connection with a similar speed? Or on a larger file?