Uwsgi IOError: write error

I have a problem with my nginx + uwsgi configuration for my django application, I keep getting these errors in the uwsgi error log:

Wed Jan 13 15:26:04 2016 - uwsgi_response_writev_headers_and_body_do (): Broken pipe [kernel / writer string. line 296] during POST / company / get_unpaid_invoices_chart / (86.34.48.7) IOError: write error

Wed Jan 13 15:26:20 2016 - uwsgi_response_write_headers_do (): Broken pipe [core / writer.c line 238] during GET / gestiune / print _pdf / nir / 136194 / (89.122.255.186) IOError: write error

I do not get them for all requests, but I get a couple of them every minute. I searched for it and I understand that this is happening because nginx closes the connection to uwsgi by the time uwsgi wants to write an answer. This looks weird because in my nginx configuration I have this:

include uwsgi_params;

uwsgi_pass unix: /home/project/django/sbo_cloud/site.sock;

uwsgi_read_timeout 600;

uwsgi_send_timeout 600;

uwsgi_connect_timeout 60;

I am sure that none of the requests for which an error occurs exceeds a timeout of 600 seconds. Any idea why this will happen?

thanks

+7
nginx uwsgi
source share
1 answer

The problem is that clients drop the connection, and then Nginx closes the connection without telling uwsgi about the interruption. Then, when uwsgi returns with the result, the socket is already closed. Nginx writes error 499 to the log, and uwsgi throws an IOError.

Not the best solution is to tell Nginx not to close the socket and wait for uwsgi to return with a response.

Put this in nginx.config:

uwsgi_ignore_client_abort on; 

It is unclear whether it is possible to tell Nginx to close the uwsgi connection. There is another problem with search queries: ( Promote http abort / close from nginx to uwsgi / Django )

+6
source share

All Articles