question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[CRITICAL] WORKER TIMEOUT

See original GitHub issue

I’m running the uvicorn-gunicorn-fastapi:python3.7 Docker-Image on an Azure App Service (B2: 200 ACU, 2 Cores, 3.5 GB Memory, OS: Linux).

My Dockerfile looks as follows:

FROM tiangolo/uvicorn-gunicorn-fastapi:python3.7

WORKDIR /app

RUN apt-get update \
    && apt install -y tesseract-ocr tesseract-ocr-deu libgl1-mesa-dev poppler-utils \
    && apt clean


COPY /app .

RUN pip install -r /app/requirements.txt

The service accepts POST requests with a file attached and processes it using tesseract and open-cv. After the file has been processed, the service responds with the result of the processed file.

Oftentimes, however, the processing stops with the following error:

2020-11-04T13:48:58.000206215Z [2020-11-04 13:48:57 +0000] [1] [CRITICAL] WORKER TIMEOUT (pid:8)

2020-11-04T13:48:58.529238062Z [2020-11-04 13:48:58 +0000] [90] [INFO] Booting worker with pid: 90
2020-11-04T13:49:00.743342241Z [2020-11-04 13:49:00 +0000] [90] [INFO] Started server process [90]
2020-11-04T13:49:00.743447942Z [2020-11-04 13:49:00 +0000] [90] [INFO] Waiting for application startup.
2020-11-04T13:49:00.748887110Z [2020-11-04 13:49:00 +0000] [90] [INFO] Application startup complete.

This error does not occur after the default timeout of 120 seconds. Still, I tried to get rid of the error by using a custom gunicorn_conf.py and increased the timeout to 180 seconds. Additionally, I tried to solve the issue by increasing/decreasing the amount of workers per core. The error still remains. I also checked the log-files on the App Service but there isn’t any further information about the error. Changing the LOG_LEVEL within the gunicorn_conf-file didn’t help, either.

Does anyone know a solution for the problem? Running the Docker-Container locally works just fine (Windows 10, Docker Engine v19.03.13)

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
moelliDocommented, Feb 3, 2021

Hi @mateusjs. App Services in Azure time out after 230 seconds by default and - AFAIK - this timeout can’t be configured. So we managed to improve the services logic such that the timeout wasn’t a problem anymore.

0reactions
kevrcommented, Feb 19, 2022

Indeed this is a real issue, originally brought up in #46. The solution provided there could help in some cases, however, in the cases we’ve seen, we haven’t even come close to reaching the default 120 second graceful timeout period.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Gunicorn worker timeout error - Stack Overflow
WORKER TIMEOUT means your application cannot response to the request in a defined amount of time. You can set ...
Read more >
CRITICAL WORKER TIMEOUT when running Flask app #1801
It seems there have been already several reports related to [CRITICAL] WORKER TIMEOUT error but it just keeps popping up. Here is my...
Read more >
How to resolve the gunicorn critical worker timeout error?
Generally set to thirty seconds. Only set this noticeably higher if you're sure of the repercussions for sync workers. For the non sync...
Read more >
Django + Gunicorn CRITICAL WORKER TIMEOUT - Reddit
I have this issue where Gunicorn fails to boot workers and they timeout without serving any request. Increasing the timeout doesn't help.
Read more >
[CRITICAL] WORKER TIMEOUT - Google Groups
Hello,. We've been experiencing issues with an experiment, often getting a gunicorn "[CRITICAL] WORKER TIMEOUT" in server.log.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found