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

Daemonized OctoPrint doesn't clean up its pidfile when receiving a TERM signal #711

Closed
rspeed opened this issue Jan 10, 2015 · 2 comments

Comments

Projects
None yet
3 participants
@rspeed
Copy link
Contributor

commented Jan 10, 2015

  1. What were you doing?

    Writing a rc.d script for FreeBSD.

  2. What did you expect to happen?

    OctoPrint would clean up its pidfile after a graceful exit.

  3. What happened instead?

    The pidfile remained in place. This caused an "already running" error to occur when I attempted to run the daemon again.

  4. Branch & Commit or Version:

    devel 3d5fdf2

  5. Printer model & used firmware incl. version

    Not relevant.

  6. Link to octoprint.log on gist.github.com or pastebin.com:

    Not relevant.

  7. Link to contents of terminal tab on gist.github.com or pastebin.com:

    https://gist.github.com/rspeed/d37acd6fc447eac1cb3e

Notes

The base issue is that daemon.py uses atexit, which states in its documentation:

The functions registered via this module are not called when the program is killed by a signal not handled by Python

Since SIGTERM is the standard POSIX way to ask a daemon to quit, and since daemons are supposed to clean up after themselves, this design requires unusual and fragile behavior in init scripts. Specifically, I noticed that the init script has this line:

rm -f $PIDFILE

That's generally considered to be a bad practice.

@GitIssueBot

This comment has been minimized.

Copy link
Collaborator

commented Jan 10, 2015

Hi @rspeed,

It looks like there is some information missing from your ticket that will be needed in order to process it properly. Please take a look at the Contribution Guidelines and the page How to file a bug report on the project wiki, which will tell you exactly what your ticket has to contain in order to be processable.

If you did not intend to report a bug, please take special note of the title format to use as described in the Contribution Guidelines.

I'm marking this one now as needing some more information. Please understand that if you do not provide that information within the next two weeks (until 2015-01-24 09:20) I'll close this ticket so it doesn't clutter the bug tracker.

Best regards,
~ Your friendly GitIssueBot

PS: I'm just an automated script, not a human being.

@foosel

This comment has been minimized.

Copy link
Owner

commented Jan 12, 2015

Fixed through PR

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