uWSGI raises OSError: write error during large request

In my case, Nginx as a backproxy of uwsgi, the config http-timeout set the server to normally wait in long running requests.

Mind that the following options included in the nginx proxy declaration:

proxy_read_timeout 300s;
proxy_connect_timeout 300s;
proxy_send_timeout 300s;

were doing nothing regarding the gateway timeout.


It may be the case that when you upload things, you use chunked encoding. There is uWSGI option --chunked-input-timeout, that by default is 4 seconds (it defaults to value of --socket-timeout, which is 4 seconds).

Though problem theoretically may lie somewhere else, I suggest you to try aforementioned options. Plus, annoying exceptions are the reason why I have

ignore-sigpipe=true
ignore-write-errors=true
disable-write-exception=true

in my uWSGI config (note that I provide 3 options, not 2):

  • ignore-sigpipe makes uWSGI not show SIGPIPE errors;
  • ignore-write-errors makes it not show errors with e.g. uwsgi_response_writev_headers_and_body_do;
  • disable-write-exception prevents OSError generation on writes.