uvicorn: Gunicorn with UvicornWorker is not respecting the timeout

I am setting up a timeout check so I made and endpoint:

@app.get("/tc", status_code=200)
def timeout_check():
    time.sleep(500)
    return "NOT OK"

I am using the docker image tiangolo/uvicorn-gunicorn-fastapi:python3.7 and my command to run the server:

CMD ["gunicorn","--log-level","debug","--keep-alive","15", "--reload", "-b", "0.0.0.0:8080", "--timeout", "15", "--worker-class=uvicorn.workers.UvicornH11Worker", "--workers=10", "myapp.main:app"]

I am expecting the endpoint to fail after 15 seconds, but it doesn’t. Seems like the timeout is not respected.

Is there any mistake in my configuration?

[!IMPORTANT]

  • We’re using Polar.sh so you can upvote and help fund this issue.
  • We receive the funding once the issue is completed & confirmed by you.
  • Thank you in advance for helping prioritize & fund our backlog.
<picture> <source media="(prefers-color-scheme: dark)" srcset="https://polar.sh/api/github/encode/uvicorn/issues/611/pledge.svg?darkmode=1"> Fund with Polar </picture>

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Reactions: 3
  • Comments: 16 (5 by maintainers)

Most upvoted comments