project-owner / Peppy.doc

Peppy documentation
GNU General Public License v3.0
55 stars 16 forks source link

Stopping Peppy crashes system #16

Closed DrTron closed 2 years ago

DrTron commented 2 years ago

Ok, this is probably not something that's relevant for most users, but I discovered that if one stops Peppy by killing the python-task, that crashes the system pretty hard. At least the wifi is down, can't say much more as I don't have monitor/keyboard connected.

As Peppy runs in userspace with user credentials, that's very unusual. Probably one of the runtime libraries that Peppy uses (pygame maybe?) doesn't like that at all.

Sadly, that also applies to the systemd service, restarting that results in a system crash, too.

Can someone verify if this is a general bug or just my system that's reacting in this way?

project-owner commented 2 years ago

I configured the player to work as a systemd service using your instructions: https://github.com/project-owner/Peppy/issues/26

I don't use Wi-Fi, With wired connection I see the following processes:

pi@raspberrypi:~ $ ps -elf | grep python
4 S pi         639     1  0  80   0 -  1611 do_wai 04:26 ?        00:00:00 /usr/bin/openvt -s -w -- python3 peppy.py
0 S pi         643   639  8  80   0 - 46968 hrtime 04:26 tty2     00:00:04 python3 peppy.py

If I kill the children process (#643) it's restarted again and I believe this is the expected systemd behavior:

pi@raspberrypi:~ $ kill -9 643
pi@raspberrypi:~ $ ps -elf | grep python
4 S pi        1042     1  0  80   0 -  1611 do_wai 04:27 ?        00:00:00 /usr/bin/openvt -s -w -- python3 peppy.py
0 S pi        1043  1042 36  80   0 - 44805 hrtime 04:27 tty3     00:00:02 python3 peppy.py

If I kill the parent systemd process (#1042) the whole system will be shutdown and I need to reboot it. I don't know if this is expected systemd behavior or not.

DrTron commented 2 years ago

I'll confirm the running processes tonight, but what you see is reasonable. It should be the same as starting Peppy from rc.local, as systemd basically just starts Peppy. With the "Restart=on-failure" option it restarts the Player when the task dies, which is the expected behavior. You can omit that option if you want to, it's not necessary for the systemd service to run. There will be a systemd process as well that requires almost no resources but watches over the Peppy task.

However, the crash has nothing to do with systemd, it also happens when Peppy is started from rc.local and then killed. I'll have a look at the code tonight and see if I can find anything standing out. A bug this severe in one of the libraries Peppy uses is likely documented somewhere.

project-owner commented 2 years ago

Please re-open the issue if you will find that it still persists.