[Solved] uwsgi Error: 504 Gateway Time-out

Front end returns 504

Uwsgi error log problem 1

1
2
3
Tue Jan 19 14:06:15 2021 - SIGPIPE: writing to a closed pipe/socket/fd (probably the client disconnected)
BrokenPipeError: [Errno 32] Broken pipe(error caused by abnormal socket closure)
broken pipe is an error that can be generated when send, write, or writeev, when one end is writing to a closed connection on the other end. error.

Uwsgi error log problem 2

1
2
3
4
5
6
7
problem 2
Fri Apr  2 17:43:17 2021 - SIGPIPE: writing to a closed pipe/socket/fd (probably the client disconnected) on request /cross_server/update_version/ (ip 192.168.10.1) !!!
Fri Apr  2 17:43:17 2021 - uwsgi_response_writev_headers_and_body_do(): Broken pipe [core/writer.c line 306] during POST /cross_server/update_version/ (192.168.10.1)
[ERROR][2021-04-02 17:43:17,212][setup.py:910]An un-handled exception was caught by salt's global exception handler:
OSError: write error
OSError: write error
OSError: write error

Analysis:

The client aborts the connection, and then Nginx closes the connection without telling uwsgi to abort. Then, when uwsgi returns the result, the socket has been closed

Solution

Add parameters to nginx configuration

1
2
3
uwsgi_send_timeout 1800;        # Specifies the timeout for connecting to the backend uWSGI.
uwsgi_connect_timeout 1800; # Specify the timeout for transmitting requests to uWSGI after the completion of the handshake.
uwsgi_read_timeout 1800; # Specify the timeout for receiving uWSGI responses, and the timeout for receiving uWSGI responses after completing the handshake.

uwsgi configuration add parameters

1
2
3
ignore-sigpipe=true #Make uWSGI not display SIGPIPE errors.
ignore-write-errors=true #Make it so that it doesn't show things likeuwsgi_response_writev_headers_and_body_do error
disable-write-exception=true #Generated when OSError is prevented from being written.

Similar Posts:

Leave a Reply

Your email address will not be published. Required fields are marked *