The Gunicorn Flask server on Heroku terminates the last request before restarting the worker, resulting in a 503 error: “Connection closed without response.”
I have analyzed hundreds of such requests, and whenever the server encounters the “Connection closed without response” error, it always occurs on the last call before that particular worker restarts.
i have set the following setting on Gunicorn server:
web: gunicorn main:app --threads=3 --max-requests=1200
with 4 workers in each dyno.
gunicorn==22.0.0
Its worth noting that the last call that ends up in error had always zero service time.
I have updated to latest gunicorn version but it had not effect
tried increasing and decreasing the threads + workers as well
reduced latency of database too