Daemonization / Popen / pipe issue
cs at zip.com.au
Sun Mar 18 05:15:48 CET 2012
On 18Mar2012 12:35, John O'Hagan <research at johnohagan.com> wrote:
| On Sat, 17 Mar 2012 18:17:10 -0400
| Lee Clemens <java at leeclemens.net> wrote:
| > Is it generally not recommended to daemonize Python applications using
| > this method?
| I'm no guru, but not that I know of. I haven't seen the os.fork method you use
| before; out of interest, why not use Thread.setDaemon?
They are two entirely different practices. Thread.setDaemon is a flag
for a particular thread telling the python system to not bother waiting
for it at exit time. The daemonize stuff Lee is using is "daemon" in the
UNIX sense: forking the main process (the whole python instance) into an
unassociated process not subject to job control etc.
I glanced at Lee's code and have seen found anything obviously wrong yet.
Maybe if I get a bit more time later.
It seems that in daemon mode the code forks first, exactly once, before
firing off any subprocesses or threads. Is this correct? If the
daemonising happened per thread that would be very bad.
BTW, Lee, there is an external module for daemonising things in the UNIX
I recommend you use it.
Cameron Simpson <cs at zip.com.au> DoD#743
The First Law of Internet Communications:
Be liberal in what you accept, and conservative in what you send. - Jon Postel
More information about the Python-list