Dear list, I'm getting intermittent 502 errors when I use "cheaper" or "max-requests" with Nginx and uWSGI. About 1 in 200 queries fail.
Here's the log from Nginx : 2019/08/16 10:17:24 [error] 24#24: *75032 upstream prematurely closed connection while reading response header from upstream, client: 194.230.252.45, server: test.urbasen.org, request: "GET /mobile/groupe_liste/ HTTP/1.1", upstream: "uwsgi://172.18.0.6:8000", host: "test.urbasen.org", referrer: "https://test.urbasen.org" It seems these happen when workers are killed, as at the same timestamp, in the uWSGI log, I have : worker 2 killed successfully (pid: 1350) uWSGI worker 2 cheaped. When I run without cheaper or max-requests (i.e. when I launch uWSGI without --cheaper=1 --cheaper-step=4 --max-requests=100), I get no errors. Obviously I don't want to do this, as my app has some long periods with no activity, and short periods with heavy activity, and I'm trying to avoid wasting too much memory on idle workers. I'm using uWSGI 2.0.18 and Nginx 1.13.7, in two separate Docker containers (alpine). Here's the whole command I use to run uWSGI that has issues : uwsgi --module=myapp.wsgi --need-app --socket=:8000 --workers=20 --threads=4 --buffer-size=8192 --cheaper=1 --cheaper-step=4 --max-requests=100 The one without issues : uwsgi --module=myapp.wsgi --need-app --socket=:8000 --workers=20 --threads=4 --buffer-size=8192 And here's the config used in Nginx : location / { uwsgi_pass django:8000; uwsgi_read_timeout 300; include /etc/nginx/uwsgi_params; } I googled extensively, found somme issues [1] [2] that seemed related, but comments didn't help. And idea on why this is happening ? What else can I try to get this working properly ? Thanks !! Olivier [1] : https://github.com/unbit/uwsgi/issues/1702 [2] : https://github.com/unbit/uwsgi/issues/1804#issuecomment-454066479
_______________________________________________ uWSGI mailing list uWSGI@lists.unbit.it http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi