tiangolo / full-stack-fastapi-couchbase

Full stack, modern web application generator. Using FastAPI, Couchbase as database, Docker, automatic HTTPS and more.
MIT License
441 stars 84 forks source link

WORKER TIMEOUT +502 Bad gateway #11

Closed zero0nee closed 5 years ago

zero0nee commented 5 years ago

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.

tiangolo commented 5 years ago

[...] 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

tiangolo commented 5 years ago

Thanks for reporting back and closing the issue! :rocket: