thesharp / daemonize

daemonize is a library for writing system daemons in Python.
MIT License
445 stars 64 forks source link

Daemonize should kill the parent process more quickly #46

Closed AaronOpfer closed 8 years ago

AaronOpfer commented 8 years ago

So Daemonize uses sys.exit in the parent process after the fork. The intention is likely that this will cause the parent process to immediately end.

However, this is not actually the case:

I suggest that, instead of callingsys.exit(0), that Daemonize reset the signal handlers to the system default handlers (away from the python default handlers that raise exceptions) and then call os.kill on itself with SIGTERM (or SIGKILL). This would prevent Python garbage collection routines in the parent from having the ability to interfere with the child process.

thesharp commented 8 years ago

Hey @AaronOpfer

Your issue is addressed in the latest code.