views:

139

answers:

2

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

A: 

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?

tadman
* the timeout is 1200 in apache* smaller files go through while larger files do not consistently.The problem seems to be network specific, works with a 2Mbps dedicated line but not with another 2Mbps wireless connection. These connections are by different ISP's. Also, can i set the timeout on a particular url under a vhost, i tried setting a 'Location' directive but it did not work.
deepak
A: 

Unfortunately this is probably a Safari bug. See this passenger bug report:

http://stackoverflow.com/questions/2904352/not-able-to-upload-in-a-passenger-app-behing-apache

And this ancient webkit bug report:

https://bugs.webkit.org/show_bug.cgi?id=5760

Which then points to a bug report at apple that either cannot be viewed or has been closed. I just experienced the problem with safari 5.0 (6533.16) on 10.6.4 with passenger 2.2.14, so clearly the problem has not been solved. Very frustrating.

The solution is to turn off keepalive for your vhost.

John
will try disabling keepalive when i get a test machine on the network. But the browser used was firefox.
deepak