jbrzusto / TO_DO

sensorgnome / motus TODO list for jbrzusto
0 stars 0 forks source link

some uploads failing due to client timeouts #172

Closed jbrzusto closed 6 years ago

jbrzusto commented 6 years ago

This is happening occasionally. The most recent case is for 3 large files uploaded from a Mac. The session began with this request:

sgdata:443 A.B.C.D - - [18/Feb/2018:15:42:12 +0000] "GET /upload/upload-from-computer.php HTTP/1.1" 302 7574 "https://motus.org/data/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"
sgdata:443 A.B.C.D - - [18/Feb/2018:18:38:01 +0000] "-" 408 137 "-" "-"

In case this is simply due to connection congestion (the upload speed here averaged ~ 60 kBytes / s), I've increased the timeouts for Apache in /etc/apache2/mods-enabled/reqtimeout.conf:

...
        # 2018-02-19: increase timeouts because uploads from clients with less reliable
        # internet access are sometimes failing with "408" codes.
        RequestReadTimeout header=60-120,minrate=100
        RequestReadTimeout body=60-120,minrate=100
jbrzusto commented 6 years ago

The problem is the ProjectSend is timing out in this situation:

Possible Fixes

A side benefit of the first approach is we can also calculate the hash of the file and check whether its a duplicate before (and possibly instead of) uploading it.

jbrzusto commented 6 years ago

We're going for none-of-the-above. The timeouts are caused by PHP's session management so we just need to increase PHP session timeouts, from 24 minutes to something larger, e.g. 24 hours:

So in /etc/php5/apache2/php.ini, we change:

session.gc_maxlifetime = 1440

to

session.gc_maxlifetime = 86400