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

Plugin breaks OctoPrint's startup if no Raspberry Pi is detected #16

Open
foosel opened this issue Nov 20, 2018 · 1 comment

Comments

@foosel
Copy link

commented Nov 20, 2018

The problem lies with these lines:

if self.isRaspi == False:
self._logger.info("This is not a Raspberry Pi - Plugin halted")
sys.exit(1)

You are nuking the whole on_after_startup handler with the sys.exit(0) here. Never call sys.exit from plugin code, you might be nuking important threads or even the whole server.

This issue so far wasn't really visible due to nothing absolutely important for OctoPrint's core happening in on_after_startup and hence potentially after this plugin has nuked it (it probably interfered with quite a number of third party plugins though). Starting with 1.3.10 this will change however, and this plugin is now breaking the whole server due to that sys.exit(0).

Additionally that gets triggered on a Pi3 even though it definitely IS a Raspberry Pi:

2018-11-20 12:40:11,317 - octoprint.plugins.roomtemp - INFO - This is not a Raspberry Pi - Plugin halted
pi@octopi:~ $ cat /proc/cpuinfo
[...]
Hardware        : BCM2835
Revision        : a02082
[...]
pi@octopi:~ $ cat /proc/device-tree/model
Raspberry Pi 3 Model B Rev 1.2

I'm blacklisting this plugin until this issue is fixed so it doesn't continue to break OctoPrint installs out there, in subtle or potentially not so subtle ways. I've also added additional hardening to OctoPrint against issues like this one that will be part of 1.3.10rc3+.

foosel added a commit to OctoPrint/plugins.octoprint.org that referenced this issue Nov 20, 2018

@foosel

This comment has been minimized.

Copy link
Author

commented Nov 20, 2018

Quick update: the fact that the RPi3 is not detected in this case here is caused by an old version of the plugin that lacks RPi3 matching and also doesn't prompt to update due to #17.

The sys.exit still must go.

@foosel foosel changed the title Plugin breaks OctoPrint's startup if no Raspberry Pi is detected (& that detection is also broken at least on RPi3) Plugin breaks OctoPrint's startup if no Raspberry Pi is detected Nov 20, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.