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

Craftbeerpi systemd service hangs until timeout #153

Open
berry-langerak opened this issue Jan 2, 2025 · 3 comments
Open

Craftbeerpi systemd service hangs until timeout #153

berry-langerak opened this issue Jan 2, 2025 · 3 comments

Comments

@berry-langerak
Copy link

The systemd service that is installed by craftbeerpi when you run "cbpi autostart" does not specify a kill signal, but the CBPI process seems to not respond to SIGTERM, which is the default kill signal.

When changing the kill signal to SIGKILL, the stopping of craftbeerpi service is much faster, although that feels like a workaround. Probably, the main python process needs to listen to SIGTERM instead.

With KillSignal=SIGTERM (default):

root@raspberry:~# systemctl start craftbeerpi.service
root@raspberry:~# time systemctl stop craftbeerpi.service

real	1m35.802s
user	0m0.027s
sys	0m0.025s

With KillSignal=SIGKILL:

root@raspberry:~# time systemctl stop craftbeerpi.service

real	0m5.161s
user	0m0.017s
sys	0m0.025s

Version information:

  • Craftbeerpi 4.4.7
  • Debian 12 (Bookworm)
  • Python 3.11.2
@avollkopf
Copy link
Member

I have observed the same issue but never found a good solution so far. I leave it open and maybe we will find something to overcome this issue. SIGKILL could cause some issues with the config files.

@berry-langerak
Copy link
Author

If you'd like, I can have a go at it. I found the code a little tough to get through, but one I find the while True, I'm pretty sure I can implement a decent enough solution.

@avollkopf
Copy link
Member

@berry-langerak You are welcome. When you start cbpi, it somewhere states

===== Running on http://0.0.0.0:8000 =====
(Press CRTL+C to quit)

This must come from the web app (aiohttp.web) and I have the impression, that this issue is related to the aiohttp config within cbpi.

There are some issues that sound similar:

aio-libs/aiohttp#1932,

https://stackoverflow.com/questions/56792288/how-to-implement-callbacks-for-sigterm-and-sigint-signals-with-aiohttp

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants