unbit / uwsgi

uWSGI application server container
http://projects.unbit.it/uwsgi
Other
3.45k stars 691 forks source link

Large uploads fail with uWSGI behind lighttpd using fastcgi #311

Closed acatton closed 11 years ago

acatton commented 11 years ago

Hi,

I'm using uWSGI 1.9.11 behind a lighttpd server, using fastcgi. I get this error in uwsgi.log when I want to upload big files on my website:

[uwsgi-body-read] Error reading 8783158 bytes. Content-Length: 9831718 consumed: 1048560 left: 8783158 message: Resource temporarily unavailable

And the POST request return a 500.

Is this a bug in uwsgi?

Regards,

prymitive commented 11 years ago

consumed: 1048560

Looks almost like a round number (probably 1MB - header) ;) can you check lighttpd logs and settings, maybe there is limit in lighttpd and uWSGI doesn't get whole POST body?

acatton commented 11 years ago

Here's what I have in access.log:

my.ip website.com - [11/Jun/2013:18:37:46 +0000] "POST /upload/?qqfile=hugerandomimage.png
HTTP/1.1" 503 369 "https://website.com/referer/"
"Mozilla/5.0 (X11; Linux x86_64; rv:20.0) Gecko/20100101 Firefox/20.0"

and error.log:

2013-06-11 18:37:46: (mod_fastcgi.c.3068) connection was dropped after accept()
(perhaps the fastcgi process died), write-offset: 1156712 socket: unix:/tmp/website.sock

Edit: Rewrapping for better reading.

unbit commented 11 years ago

are you sure it is not the bug solved in 1.9.12 ?

acatton commented 11 years ago

I just upgraded to 1.9.12, and tried again. lighttpd error.log:

2013-06-12 16:02:02: (mod_fastcgi.c.3068) connection was dropped after accept()
(perhaps the fastcgi process died), write-offset: 2049026 socket: unix:/tmp/website.sock

uwsgi.log:

[uwsgi-body-read] Error reading 7931203 bytes. Content-Length: 9831718 consumed: 1900515
left: 7931203 message: Resource temporarily unavailable

The data sizes are different (same site, same request, same file uploading)

unbit commented 11 years ago

can you report your whole uWSGI config ? i would like to try reproducing the error

acatton commented 11 years ago

Sure,

uWSGI is ran like this with those arguments:

--master
--pidfile $pid
--emperor /etc/vassals/
--uid www-data
--daemonize /var/log/uwsgi/uwsgi.log
--limit-post 104857600

Here's a vassal template:

[uwsgi]
fastcgi-socket = /tmp/website.sock
processes = 6
master = 1
env = DJANGO_SETTINGS_MODULE=website.settings 
env = PATH=/var/python-environments/website/bin:/usr/bin:/bin:$PATH
env = LC_ALL=en_US.UTF-8
env = LANG=en_US.UTF-8
module = website.wsgi
home = /var/python-environments/website/
chdir = /var/www/website.com/
protocol = fastcgi
unbit commented 11 years ago

can you try with latest code from github ?

acatton commented 11 years ago

@unbit I cannot test it because this is on one of my live server. I tried to setup another server in order to reproduce it. I didn't manage to reproduce this bug. I think this related to my configuration.

Thanks.

gavinwahl commented 11 years ago

I am experiencing this issue in 1.9.14. Same configuration and error messages as @acatton.