My question is very similar to uWSGI raises OSError: write error during large request
I have a python flask app running on EC2.
To enable download of files from the UI interface (by clicking a button), I run this on ec2:
uwsgi --socket 0.0.0.0:8000 --protocol=http -w wsgi:application -z 120 --http-timeout 120 --enable-threads -H /home/test/env --daemonize /home/test/test.log
and the UI becomes operational. When i click the download button certain computations take place before the csv becomes ready to download. I don't have a uwsgi.ini file or any kind of nginx.
9/10 files download fine, but some files while trying to download throw this in the log:
Wed May 5 18:26:01 2021 - SIGPIPE: writing to a closed pipe/socket/fd (probably the client disconnected) on request /abc/jobid (ip xx.xx.xv.redacted_ip) !!!
Wed May 5 18:26:01 2021 - uwsgi_response_write_body_do(): Broken pipe [core/writer.c line 341] during
GET /abc/jobid (xx.xx.xv.redacted_ip)
OSError: write error
and the F12 on Web UI shows
main.js:678 GET https://my_api_url/jobid 504 (Gateway Timeout)
main.js:678 Uncaught (in promise) Error: Request failed with status code 504
at e.exports (main.js:678)
at e.exports (main.js:993)
at XMLHttpRequest.d.onreadystatechange (main.js:678)
I'm already using the -z 120 and the --http-timeout 120 options but doesn't seem to be making a difference https://stackoverflow.com/a/28458462/4590025.
I also looked at https://stackoverflow.com/a/63109495/4590025 but it is not clear where/how to try it as
How do I debug this further?