Reputation: 4144
For some reason when my Flas app is deployed to the Docker it will crash on multiple requests with an error
nginx | 2020/06/26 20:41:39 [error] 20#20: *1 upstream prematurely closed connection while reading response header from upstream, client: 172.18.0.1, server: , request: "POST /api/v1.0/export HTTP/1.1", upstream: "uwsgi://172.18.0.2:5555", host: "127.0.0.1:80"
flask | DAMN ! worker 4 (pid: 16) died, killed by signal 9 :( trying respawn ...
flask | Respawned uWSGI worker 4 (new pid: 18)
The app works fine when run on venv
uWSGI config looks like:
[uwsgi]
wsgi-file = run.py
callable = app
socket = :5555
processes = 16
threads = 2
master = true
chmod-socket = 660
vacuum = true
die-on-term = true
harakiri-verbose = true
and nginx config looks like:
server {
listen 80;
location / {
include uwsgi_params;
uwsgi_pass flask:5555;
uwsgi_read_timeout 300;
}
client_max_body_size 100M;
client_header_timeout 120s;
client_body_timeout 120s;
keepalive_timeout 120s;
send_timeout 120s;
}
Any thoughts on that?
Upvotes: 0
Views: 3225
Reputation: 11
I was having similar problem and did the following changes:
reload-on-rss=4048
threads=10
enable-threads=true
harakiri=130
For me this solved the issue.
Upvotes: 1