Server gets immediately nuked on restart/stop, no chance to run shutdown events/hooks

Open
#13 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
shell

Research direction

Compare the systemd unit behavior in OctoPi versions before 1.0 with OctoPi 1.0, focusing on how restart and stop terminate the server. Reproduce the issue and inspect the shutdown logs; done means shutdown hooks and events run before the server is terminated.

Written by the indexing model from the issue text.

Description

It looks like we have a behaviour change in that regard from from OctoPi < 1.0.0 to OctoPi >= 1.0.0.

Example:

OctoPi 0.18.0:

2023-11-28 17:52:47,473 - octoprint.server - INFO - Shutting down...
2023-11-28 17:52:47,485 - octoprint.server - INFO - Calling on_shutdown on plugins
2023-11-28 17:52:47,489 - octoprint.events - INFO - Processing shutdown event, this will be our last event
2023-11-28 17:52:47,672 - octoprint.events - INFO - Event loop shut down
2023-11-28 17:52:47,921 - octoprint.plugins.tracking - INFO - Sent tracking event shutdown, payload: {}
2023-11-28 17:52:48,111 - octoprint.server - INFO - Goodbye!
2023-11-28 17:52:55,660 - octoprint.startup - INFO - ******************************************************************************
2023-11-28 17:52:55,663 - octoprint.startup - INFO - Starting OctoPrint 1.9.3
2023-11-28 17:52:55,665 - octoprint.startup - INFO - ******************************************************************************

OctoPi 1.0:

2023-11-28 17:58:10,696 - octoprint.plugins.github_release_patcher - INFO - Started dummy release server on http://127.0.0.1:50672
2023-11-28 17:58:10,696 - octoprint.plugins.github_release_patcher - INFO - Set Github release URL to http://127.0.0.1:50672/releases/{user}/{repo}
2023-11-28 18:01:21,363 - octoprint.startup - INFO - ******************************************************************************
2023-11-28 18:01:21,366 - octoprint.startup - INFO - Starting OctoPrint 1.9.3
2023-11-28 18:01:21,367 - octoprint.startup - INFO - ******************************************************************************

No shutdown events triggered. It looks like the systemd unit on 1.0 simply nukes away the server directly, whereas on OctoPi < 1.0 it still got a chance to cleanly shut down. That's something that needs to get looked at, but that's rather something for OctoPrint/OctoPi-UpToDate or guysoft/OctoPi.

Originally posted by @foosel in https://github.com/OctoPrint/OctoPrint/issues/4882#issuecomment-1830406813

Dominant language
Shell
Stars
72
Forks
13
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from OctoPrint/OctoPi-UpToDate

All issues in OctoPrint/OctoPi-UpToDate

Similar issues

More Shell/Bash issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.