uwsgi IOError: write error

前端 未结 2 1234
遥遥无期
遥遥无期 2021-01-31 17:43

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

Wed Jan 13 15:26:04 2016 - uwsgi_res

相关标签:
2条回答
  • 2021-01-31 17:53

    The problem is that clients abort the connection and then Nginx closes the connection without telling uwsgi to abort. Then when uwsgi comes back with the result the socket is already closed. Nginx writes a 499 error in the log and uwsgi throws a IOError.

    The non optimal solution is to tell Nginx not to close the socket and wait for uwsgi to come back with a response.

    Put uwsgi_ignore_client_abort in your nginx.config.

    location @app {
        include uwsgi_params;
        uwsgi_pass unix:///tmp/uwsgi.sock;
    
        # when a client closes the connection then keep the channel to uwsgi open. Otherwise uwsgi throws an IOError
        uwsgi_ignore_client_abort on;
    }
    

    It is not clear if it is possible to tell Nginx to close the uwsgi connection. There is another SO questin about this issues: (Propagate http abort/close from nginx to uwsgi / Django)

    0 讨论(0)
  • 2021-01-31 18:06

    Alternative solution is to put the following settings in uWSGI config:

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

    See https://github.com/getsentry/raven-python/issues/732

    0 讨论(0)
提交回复
热议问题