meinheld
meinheld copied to clipboard
File upload fails with 502
I am using Gunicorn + Flask + Meinheld + NGINX with egg:meinheld#gunicorn_worker setting but when I try to upload more than 10 MB server fails with 502 Bad Gateway. I think Meinheld causes the issue because I can upload the same files with sync workers.
Exact error is:
[error] 4338#4338: *1 sendfile() failed (32: Broken pipe) while sending request to upstream, client: 127.0.0.1, server: localhost, request: "POST /******** HTTP/1.1", upstream: "http://127.0.0.1:8000/*********", host: "localhost", referrer: "http://localhost/******/"
Edit: When I disable Gunicorn and use only Meinheld, it works without an error.
Any ideas?
hi @keremnymn
Could you please show me each middleware settings? (nginx, gunicorn and so
Gunicorn:
gunicorn --workers=6 --worker-class="egg:meinheld#gunicorn_worker" app:app
app.py:
import meinheld, os
from **** import create_app
app = create_app()
if __name__ == "__main__":
if os.environ['RUNNING_ON'] == 'localhost':
app.run(debug=True)
else:
meinheld.listen(("0.0.0.0", 5000))
meinheld.run(app)
nginx:
server {
listen 80;
server_name localhost;
client_max_body_size 512M;
location /static {
alias /********/static;
}
location / {
proxy_pass http://localhost:8000;
include /etc/nginx/proxy_params;
}
}
any updates about this issue?
I solve it by changing to gevent, I use gunicorn with meinheld before but now using gunicorn with gevent.
gunicorn --bind=0.0.0.0:5000 -w 3 --worker-class=gevent app:app --timeout 60
I had the same problem
caddy -> gunicorn(meinheld) -> django
gunicorn --workers=5 --worker-class="egg:meinheld#gunicorn_worker" --bind :8000 myproject.wsgi
When upload 3M image file via form, it's display Request timeout
, Then I just use gunicorn
caddy -> gunicorn -> django
gunicorn --workers=5 --bind :8000 myproject.wsgi
It's working.
@jet10000
https://m.xkcd.com/979/