uvicorn-gunicorn-fastapi-docker icon indicating copy to clipboard operation
uvicorn-gunicorn-fastapi-docker copied to clipboard

TIMEOUT parameter not working

Open pererumbo opened this issue 3 years ago • 1 comments

I'm running the docker on an AWS instance and I have an endpoint that performs heavy calculations. Depending on the input it can take more than 1 minute to process. The problem is that for big inputs it always returns a 504 Gateway Timeout after 60 seconds.

I've tried to set the TIMEOUT parameter in the docker run command as specified in the docs but it doesn't seem to modify this timeout. I've checked the gunicorn documentation and it says that the default timeout is 30 seconds and the grace_timeout is also 30 seconds. This make me think that these parameters are not being overwritten because the sum of both is 60 seconds, exactly the same time it takes to raise the timeout error.

pererumbo avatar Nov 25 '21 09:11 pererumbo

If you're using an ELB in front of your instance, it might be the Load Balancer closing the connection (default timeout is 60s) https://aws.amazon.com/de/blogs/aws/elb-idle-timeout-control/

flyingjoe avatar Jan 12 '22 14:01 flyingjoe