Код: Выделить всё
sudo systemctl restart gunicorn
< /code>
Это был мой файл конфигурации службы: < /p>
[Unit]
Description=gunicorn daemon for FlaskRestX API
After=network.target
[Service]
User=flaskuser
Group=flaskuser
WorkingDirectory=/var/www/webshop
EnvironmentFile=/var/www/webshop/.env
ExecStart=/var/www/webshop/venv/bin/gunicorn -w 3 -b 127.0.0.1:8000 --threads 2 --timeout 30 api:app
[Install]
WantedBy=multi-user.target
< /code>
Это привело к Sqlalchemy, библиотеке Python для операций MySQL CRUD, чтобы бросить Errros не на уровне приложения, а на уровне драйвера. Используя журнал, я нашел возможную причину: < /p>
Apr 09 06:20:30 ubuntu-s-1vcpu-2gb-70gb-intel-ams3-01 systemd[1]: gunicorn.service: Found left-over process 968 (gunicorn) in control group while starting unit. Ignoring.
Apr 09 06:20:30 ubuntu-s-1vcpu-2gb-70gb-intel-ams3-01 systemd[1]: gunicorn.service: This usually indicates unclean termination of a previous run, or service implementation deficiencies.
Apr 09 06:20:30 ubuntu-s-1vcpu-2gb-70gb-intel-ams3-01 systemd[1]: gunicorn.service: Found left-over process 985 (gunicorn) in control group while starting unit. Ignoring.
Apr 09 06:20:30 ubuntu-s-1vcpu-2gb-70gb-intel-ams3-01 systemd[1]: gunicorn.service: This usually indicates unclean termination of a previous run, or service implementation deficiencies.
edit /etc/systemd/system/gunicorn.service, см. Дополнение ниже. /> Выключите VPS и включите его обратно (ничто иное не помогло с точки зрения убийства затяжных процессов), которые останавливались и автоматически восстановили надписей в этом случае < /li>
< /ul>
Добавлено в файл конфигурации SystemCtl: < /p>
< /ul>
.
Код: Выделить всё
# Ensure that systemd kills the entire process group or control group
KillMode=control-group
# Optionally set a shorter timeout, so that systemd doesn't wait too long
TimeoutStopSec=10
# Explicitly use SIGKILL for ultimate assurance
KillSignal=SIGKILL
Подробнее здесь: https://stackoverflow.com/questions/795 ... -db-issues
Мобильная версия