50đź‘Ť
This can happen when NGINX started a request to uWSGI but uWSGI took too long to respond, then NGINX closes the connection to uWSGI. When uWSGI finally finishes, it tries to give it’s response back to NGINX, but NGINX closed the connection earlier, so then uWSGI throws an I/O error.
So this could mean that your uWSGI process is taking too long.
Update:
uWSGI’s Harakiri mode could be useful to automatically terminate such long taking processes if you want to:
https://uwsgi-docs.readthedocs.io/en/latest/FAQ.html#what-is-harakiri-mode
You might not want to do this because a process might be finishing some long query or something which could be necessary.
6đź‘Ť
This error means that the client has closed the connection before uWSGI/Django sends the response. It is generally caused by a timeout in the browser or web server frontend.
To fix it, you need to verify that your setup is correct. Look to see that all of your application’s parts (including database adapters) are gevent-friendly. If they’re not, you will get no advantage with gevent, and this could even lead to a decrease in performance.
In addition to this, you need to make sure that your database server is able to manage 1200 concurrent connections. If not, it may be ignoring connection attempts.
- [Django]-How do I separate my models out in django?
- [Django]-Django DetailView – how to use 'request' in get_context_data
- [Django]-How to define a default value for a custom Django setting
3đź‘Ť
Now I am not recommending this without you considering your situation. But you could turn uwsgi_ignore_client_abort to “on”. With this turned on nginx will keep the aborted connection open until uwsgi returns. Why I don’t recommend this completely is because this means an nginx connection will now be tied up until the request finishes. But really the uwsgi thread wasn’t being aborted, so aborting the nginx connection early isn’t really gaining you much in my opinion.
- [Django]-Prepopulate Django (non-Model) Form
- [Django]-How can I auto-populate a PDF form in Django/Python?
- [Django]-Simple Subquery with OuterRef