Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

330
Views
La aplicación gunicorn Flask se bloquea en Docker

Tengo una aplicación Flask que ejecuto a través de gunicorn (en una computadora portátil Dell latitude 5410 con Ubuntu 20.04) y configuré el Docker para ejecutarlo como se sugiere en esta maravillosa guía .

Aquí está mi boot.sh :

 #!/bin/sh source venv/bin/activate while true; do flask db init flask db migrate flask db upgrade if [[ "$?" == "0" ]]; then break fi echo Deploy command failed, retrying in 5 secs... sleep 5 done exec gunicorn -b 0.0.0.0:5000 --access-logfile - --error-logfile - main:app

y el Dockerfile simplemente llámalo como punto de entrada:

 FROM python:3.8-alpine RUN adduser -D diagnosticator RUN apk add --no-cache bash mariadb-dev mariadb-client python3-dev build-base libffi-dev openssl-dev WORKDIR /home/diagnosticator COPY requirements.txt requirements.txt RUN python -m venv venv RUN venv/bin/pip install -U pip RUN venv/bin/pip install wheel RUN venv/bin/pip install -r requirements.txt RUN venv/bin/pip install gunicorn pymysql COPY app app COPY upload upload COPY variant_dependencies variant_dependencies COPY main.py config.py boot.sh ./ COPY convert_VCF_REDIS.py asilo_variant_functions.py cloud_bigtable_functions.py mongodb_functions.py redis_functions.py ./ COPY docker_functions.py ./ RUN chmod a+x boot.sh ENV FLASK_APP main.py RUN chown -R diagnosticator:diagnosticator ./ USER diagnosticator EXPOSE 5000 ENTRYPOINT ["./boot.sh"]

Ejecuto Docker en una docker-network con:

 docker network create --driver bridge diagnosticator-net

El problema que noté es que el contenedor Docker, por alguna razón, se bloquea después de un poco de inactividad con un error de gunicorn :

[CRÍTICO] TIEMPO ESPERA DEL TRABAJADOR

aquí la ventana acoplable registra:

 192.168.32.1 - - [12/Jun/2021:12:28:30 +0000] "GET /patient_page/GHARIgANY21uuITW2196372 HTTP/1.1" 200 19198 "http://127.0.0.1:3000/patient_result" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.77 Safari/537.36" [2021-06-12 12:29:10 +0000] [1] [CRITICAL] WORKER TIMEOUT (pid:16) [2021-06-12 12:29:10 +0000] [16] [INFO] Worker exiting (pid: 16) [2021-06-12 12:29:10 +0000] [17] [INFO] Booting worker with pid: 17 [2021-06-12 12:29:10,905] INFO in __init__: Diagnosticator-local startup [2021-06-12 12:29:41 +0000] [1] [CRITICAL] WORKER TIMEOUT (pid:17) 20 [2021-06-12 12:29:41 +0000] [17] [INFO] Worker exiting (pid: 17) [2021-06-12 12:29:41 +0000] [18] [INFO] Booting worker with pid: 18 [2021-06-12 12:29:42,094] INFO in __init__: Diagnosticator-local startup [2021-06-12 12:30:12 +0000] [1] [CRITICAL] WORKER TIMEOUT (pid:18) [2021-06-12 12:30:12 +0000] [18] [INFO] Worker exiting (pid: 18)

y la aplicación simplemente se cuelga cargando para siempre cualquier página a la que intente acceder.

He visto algunas sugerencias aquí y las busqué en Google, como esta o esta , sugiriendo trabajar en gunicorn --timeout pero el problema sigue ocurriendo sin importar lo que ponga allí.

¡Cualquier ayuda será muy apreciada porque no puedo encontrar ninguna solución real!

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Intente ejecutar Gunicorn con --log-level debug... Debería dar alguna pista sobre el error.

Además, puede intentar agregar --worker-class en su comando gunicorn

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!