5

I have a site that used to be able to upload large files (large being > 10 or 20mb) but no longer can. I've been debugging this for hours at this point.

All php values are set ludicrously high:

post_max_size = 512M
upload_max_filesize = 512M
memory_limit = 1024M
max_execution_time = 600
max_input_time = 600

I've also set TimeOut 600 in httpd.conf.

Essentially, if I add a large file to an upload field, it never uploads. I can witness the "Uploading (1%)..." in the lower left in chrome showing the file start uploading. It will count up, sometimes even reaching 100%, then start over again at 0 and start counting up again, eventually failing with an ERR_CONNECTION_RESET message.

The eventual failure seems to happen after a random amount of time, sometimes 24 seconds, simetimes 3 minutes.

I tried a 170mb file and it will always get to 16 or 17% before it restarts. That always takes something like 22 seconds. Then, it will restart at 0 and count up to 16 or 17% again, then restart again. It ultimately fails with the ERR_CONNECTION_RESET message sometimes after restarting once, sometimes after restarting 4 or 5 times.

I also tried a 30mb file. This one will always reach right around 100% before restarting.

df -h shows plenty of file space remaining, and I was able to upload files fine via SFTP confirming that there is indeed sufficient hard disk space.

Files also upload fine using the exact same application on my development server, so I can rule out any application issues.

Smaller files also upload fine on the production server, i've tried files as large as 3 or 5mb with no issue.

I'm able to execute code like:

echo "start";
sleep(60);
echo "stop";

without any hiccup on production, so it isn't timing out all requests, only the uploads.

I've tried multiple browsers, and this is happening from multiple client locations.

There is never an error in any log I can find in /var/log/httpd.

I'm not running mod security. Nowhere in my application are any of the php settings overwritten. It's a pretty standard installation of apache and php.

The production server is Amazon Linux running Apache/2.4.39 and I've tried it on php 7.1 and php 7.2 and got the same result, both using mod_php.

I am well into the "banging head against wall" stage of this issue. Does anyone have any ideas what I can do to debug this?

miken32
  • 42,008
  • 16
  • 111
  • 154
Pez
  • 1,251
  • 16
  • 32

1 Answers1

3

Finally got this to work. Thanks to net::ERR_CONNECTION_RESET when large file takes longer than a minute

I had to add RequestReadTimeout header=0 body=0 to my httpd.conf file

It couldn't be within a vhost definition, at least I tried that hours ago and nothing. But, circled back and tried it again in httpd.conf and it worked.

TG.

Pez
  • 1,251
  • 16
  • 32