问题
Here is the error log that I received when I put my application in the long run.
Oct 22 11:41:18 uwsgi[4613]: OSError: write error
Oct 22 11:41:48 uwsgi[4613]: Tue Oct 22 11:41:48 2019 - uwsgi_response_write_body_do(): Broken pipe [core/writer.c line 341] during GET /api/events/system-alarms/
Nov 19 19:11:01 uwsgi[30627]: OSError: write error
Nov 19 19:11:02 uwsgi[30627]: Tue Nov 19 19:11:02 2019 - uwsgi_response_writev_headers_and_body_do(): Broken pipe [core/writer.c line 306] during GET /api/statistics/connected-clients/?type=auto&required_fields=0,11
Also, I need to know the reason for the os write error and a broken pipe in detail.
回答1:
Faced a similar issue before, it happens when the client makes a request and then closes it (either because server took too long to respond or client has been disrupted) but uwsgi is still processing that request.
From the Tags I notice that you are using nginx+uwsgi configuration, there are multiple ways to solve this :
- Find your most time consuming request and match it between nginx and uwsgi(harakiri). Note that this doesn't work when client itself disrupts.
- On your nginx config set
uwsgi_ignore_client_abort on
for uwsgi routes. - Or you can just disable logging of write errors
ignore-write-errors = true
.
来源:https://stackoverflow.com/questions/59026602/uwsgi-oserror-write-error-during-get-request