tiangolo/full-stack-fastapi-couchbase

WORKER TIMEOUT +502 Bad gateway

zero0nee opened this issue ยท 2 comments

Hi @tiangolo !

As always I'm impressed by your work. As I've said many times before, FastAPI is my absolute favourite project on all of GitHub.

I've set up an API that seems to work fine. However, when I post a large request I get 502 Bad Gateway as a response. When I check the docker log in backend_1 I get the following error message.

[2019-03-31 18:56:46 +0000] [1] [CRITICAL] WORKER TIMEOUT (pid:211)
[2019-03-31 18:56:47 +0000] [372] [INFO] Booting worker with pid: 372

Why is the worker timing out? Also when I time how long it takes for the timeout it always varies. Sometimes its after 20 seconds, sometimes 4 seconds, sometimes 15 seconds etc.

[...] FastAPI is my absolute favourite project on all of GitHub.

๐Ÿ˜๐Ÿค˜๐Ÿš€๐ŸŽ‰


You can add a custom Gunicorn file with a larger timeout: https://github.com/tiangolo/uvicorn-gunicorn-fastapi-docker/blob/master/README.md#custom-gunicorn-configuration-file

You just create a variable timeout with how many seconds it should give (e.g., 300 for 5 minutes).

Make sure you copy the rest of the original Gunicorn file too: https://github.com/tiangolo/uvicorn-gunicorn-docker/blob/master/python3.6/gunicorn_conf.py

Thanks for reporting back and closing the issue! ๐Ÿš€