Gunicorn: тайм-аут рабочего и выход рабочего во всех контейнерахPython

Программы на Python
Ответить Пред. темаСлед. тема
Anonymous
 Gunicorn: тайм-аут рабочего и выход рабочего во всех контейнерах

Сообщение Anonymous »


Небольшая предыстория моей проблемы:

У меня есть следующий файл конфигурации Gunicorn:

Код: Выделить всё

gunicorn_cofig.py

Код: Выделить всё

pidfile = 'app.pid'
worker_tmp_dir = '/dev/shm'
worker_class = 'gthread'
workers = 1
worker_connections = 1000
timeout = 30
keepalive = 1
threads = 2
proc_name = 'app'
bind = '0.0.0.0:8080'
backlog = 2048
accesslog = '-'
errorlog = '-'
Initially, I was running a single Flask app and Nginx in Docker and Gunicorn never had an issue. Later I added another app and configured my Nginx to redirect requests from different subdomain to different port (ex. mydomain.com -> port 81 and app.mydomain.com -> port 5000) (If I understand correctly since I bind all subdomains to the same IP (I use LetsEncrypt) request from all subdomains come to port 443 then Nginx reverse proxies them to respective ports). For that I just copy pasted the same

Код: Выделить всё

gunicorn_cofig.py
in the new app and it was working fine.
Now I added 6 apps and I am using the same config file in all of them and I am getting the following error:

Код: Выделить всё

app1           [2022-01-13 05:30:26 +0000] [1] [CRITICAL] WORKER TIMEOUT (pid:9)
app1          | [2022-01-13 05:30:26 +0000] [1] [CRITICAL] WORKER TIMEOUT (pid:10)
app1          | [2022-01-13 05:30:26 +0000] [1] [CRITICAL] WORKER TIMEOUT (pid:11)
app1          | [2022-01-13 05:30:26 +0000] [11] [INFO] Worker exiting (pid: 11)
app1          | [2022-01-13 05:30:26 +0000] [9] [INFO] Worker exiting (pid: 9)
app1          | [2022-01-13 05:30:26 +0000] [10] [INFO] Worker exiting (pid: 10)
app1          | [2022-01-13 05:30:27 +0000] [1] [WARNING] Worker with pid 9 was terminated due to signal 9
app1          | [2022-01-13 05:30:27 +0000] [1] [WARNING] Worker with pid 11 was terminated due to signal 9
app1          | [2022-01-13 05:30:27 +0000] [12] [INFO] Booting worker with pid: 12
app1          | [2022-01-13 05:30:27 +0000] [1] [WARNING] Worker with pid 10 was terminated due to signal 9
app1         | [2022-01-13 05:30:27 +0000] [13] [INFO] Booting worker with pid: 13
app2         | [2022-01-13 05:30:27 +0000] [1] [CRITICAL] WORKER TIMEOUT (pid:9)
app2         | [2022-01-13 05:30:27 +0000] [1] [CRITICAL] WORKER TIMEOUT (pid:10)
app2         | [2022-01-13 05:30:27 +0000] [10] [INFO] Worker exiting (pid: 10)
app2         | [2022-01-13 05:30:27 +0000] [1] [CRITICAL] WORKER TIMEOUT (pid:11)
app2         | [2022-01-13 05:30:27 +0000] [9] [INFO] Worker exiting (pid: 9)
app1         | [2022-01-13 05:30:27 +0000] [14] [INFO] Booting worker with pid: 14
and so on, for every app.
I tried to change

Код: Выделить всё

proc_name = 'app'
to different values but the same thing is happening. Here's a snippet of my docker compose file where I run the command for Gunicorn:

Код: Выделить всё

m:
build:
dockerfile: ./m/Dockerfile
context: ../../
command: gunicorn --bind 0.0.0.0:82 --workers 3 ${M_FLASK_APP}:app
environment:
- FLASK_ENV=${FLASK_ENV}
- PYTHONUNBUFFERED=1
ports:
- 82:82
volumes:
- ./m/src:/opt/m

p:
build:
dockerfile: ./p/Dockerfile
context: ../../
command: gunicorn --bind 0.0.0.0:83 --workers 3 ${P_FLASK_APP}:app
environment:
- FLASK_ENV=${FLASK_ENV}
- PYTHONUNBUFFERED=1
ports:
- 83:83
volumes:
- ./p/src:/opt/p
Can somebody guide me to the right direction. Is it gunicorn configuration problem or docker (since I am running six apps and 1 nginx server)?


Источник: https://stackoverflow.com/questions/706 ... containers
Реклама
Ответить Пред. темаСлед. тема

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

  • Похожие темы
    Ответы
    Просмотры
    Последнее сообщение

Вернуться в «Python»