[Python-Dev] Daemon creation code in the standard library (was: Inherance of file descriptor and handles on Windows (PEP 446))

Antoine Pitrou solipsis at pitrou.net
Thu Jul 25 17:26:58 CEST 2013


Le Thu, 25 Jul 2013 12:08:18 +1000,
Ben Finney <ben+python at benfinney.id.au> a écrit :
> Guido van Rossum <guido at python.org> writes:
> 
> > To reduce the need for 3rd party subprocess creation code, we should
> > have better daemon creation code in the stdlib -- I wrote some damn
> > robust code for this purpose in my previous job, but it never saw
> > the light of day.
> 
> Work continues on the PEP 3143-compatible ‘python-daemon’, porting it
> to Python 3 and aiming for inclusion in the standard library.

The PEP hasn't been formally accepted yet, however.
Skimming back through the archives, one sticking point was the default
value of the "umask" parameter. Setting the umask to 0 if the user
didn't ask for something else is a disaster, security-wise.

Another problem I've had when using it is that the `pidfile` combines
the notion of pidfile and process lock in one unique attribute. This
is quite inflexible when you're using something else than Skip
Montanaro's "lockfile" library. I'm using a separate lock based on
locket.py:
https://github.com/mwilliamson/locket.py
because it is based on POSIX advisory locks, and therefore doesn't
suffer from the "stale pid file" issues you get when a process
(or the whole system) crashes.

Therefore I'd be -1 on the PEP until those issues are alleviated.

Regards

Antoine.




More information about the Python-Dev mailing list