Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gunicorn exits on database upgrade #760

Closed
Salamandar opened this issue May 22, 2021 · 2 comments
Closed

gunicorn exits on database upgrade #760

Salamandar opened this issue May 22, 2021 · 2 comments

Comments

@Salamandar
Copy link
Contributor

Hi,
I've got an issue where on the initial database upgrade, ihatemoney exits after having done the upgrade.
I'm expecting gunicorn to "survive" and create new workers after that, and not have the user manually restart ihatemoney, right ?

Here is the syslog :

May 22 19:49:09 salamandar.fr ihatemoney[13368]: [2021-05-22 19:49:09 +0200] [13368] [INFO] Starting gunicorn 20.1.0
May 22 19:49:09 salamandar.fr ihatemoney[13368]: [2021-05-22 19:49:09 +0200] [13368] [INFO] Listening at: unix:/tmp/budget.gunicorn_ihatemoney__2.sock (13368)
May 22 19:49:09 salamandar.fr ihatemoney[13368]: [2021-05-22 19:49:09 +0200] [13368] [INFO] Using worker: sync
May 22 19:49:09 salamandar.fr ihatemoney[13368]: [2021-05-22 19:49:09 +0200] [13375] [INFO] Booting worker with pid: 13375
May 22 19:49:09 salamandar.fr ihatemoney[13368]: [2021-05-22 19:49:09 +0200] [13377] [INFO] Booting worker with pid: 13377
May 22 19:49:09 salamandar.fr ihatemoney[13368]: [2021-05-22 19:49:09 +0200] [13379] [INFO] Booting worker with pid: 13379
May 22 19:49:12 salamandar.fr ihatemoney[13368]: INFO  [alembic.runtime.migration] Context impl MySQLImpl.
May 22 19:49:12 salamandar.fr ihatemoney[13368]: INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
May 22 19:49:12 salamandar.fr ihatemoney[13368]: INFO  [alembic.runtime.migration] Context impl MySQLImpl.
May 22 19:49:12 salamandar.fr ihatemoney[13368]: INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
May 22 19:49:12 salamandar.fr ihatemoney[13368]: INFO  [alembic.runtime.migration] Running upgrade  -> b9a10d5d63ce, Initial migration
May 22 19:49:12 salamandar.fr ihatemoney[13368]: /var/www/ihatemoney__2/venv/lib/python3.7/site-packages/pymysql/cursors.py:170: Warning: (1280, "Name 'alembic_version_pkc' ignored for PRIMARY key.")
May 22 19:49:12 salamandar.fr ihatemoney[13368]:   result = self._query(query)
May 22 19:49:12 salamandar.fr ihatemoney[13368]: INFO  [alembic.runtime.migration] Running upgrade  -> b9a10d5d63ce, Initial migration
May 22 19:49:12 salamandar.fr ihatemoney[13368]: INFO  [alembic.runtime.migration] Context impl MySQLImpl.
May 22 19:49:12 salamandar.fr ihatemoney[13368]: INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
May 22 19:49:12 salamandar.fr ihatemoney[13368]: INFO  [alembic.runtime.migration] Running upgrade  -> b9a10d5d63ce, Initial migration
May 22 19:49:12 salamandar.fr ihatemoney[13368]: INFO  [alembic.runtime.migration] Running upgrade b9a10d5d63ce -> 26d6a218c329, Add Person.weight column
May 22 19:49:12 salamandar.fr ihatemoney[13368]: INFO  [alembic.runtime.migration] Running upgrade 26d6a218c329 -> f629c8ef4ab0, Initialize all members weights to 1
May 22 19:49:12 salamandar.fr ihatemoney[13368]: INFO  [alembic.runtime.migration] Running upgrade f629c8ef4ab0 -> b78f8a8bdb16, hash project passwords
May 22 19:49:12 salamandar.fr ihatemoney[13368]: [2021-05-22 19:49:12 +0200] [13368] [WARNING] Worker with pid 13375 was terminated due to signal 15
May 22 19:49:12 salamandar.fr ihatemoney[13368]: INFO  [alembic.runtime.migration] Running upgrade b78f8a8bdb16 -> afbf27e6ef20, add bill.import_date field
May 22 19:49:12 salamandar.fr ihatemoney[13368]: INFO  [alembic.runtime.migration] Running upgrade afbf27e6ef20 -> a67119aa3ee5, Migrate negative weights
May 22 19:49:13 salamandar.fr ihatemoney[13368]: [2021-05-22 19:49:13 +0200] [13368] [INFO] Shutting down: Master
May 22 19:49:13 salamandar.fr ihatemoney[13368]: [2021-05-22 19:49:13 +0200] [13368] [INFO] Reason: Worker failed to boot.
May 22 19:49:13 salamandar.fr systemd[1]: ihatemoney__2.service: Main process exited, code=exited, status=3/NOTIMPLEMENTED
@zorun
Copy link
Collaborator

zorun commented Jul 14, 2021

It sounds like a bug, gunicorn is not supposed to exit after migration. Signal 15 is SIGTERM.

Can you share more details about your environment? OS, version, pip freeze, your SQLALCHEMY_DATABASE_URI variable, the exact command you run, etc.

@almet
Copy link
Member

almet commented Oct 17, 2021

Closing due to a lack of information. Don't hesitate to re-open if you have more info. Thanks!

@almet almet closed this as completed Oct 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants