Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #21836 > unrolled thread

Re: Daemonization / Popen / pipe issue

Started byLee Clemens <java@leeclemens.net>
First post2012-03-17 18:17 -0400
Last post2012-03-17 18:17 -0400
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Daemonization / Popen / pipe issue Lee Clemens <java@leeclemens.net> - 2012-03-17 18:17 -0400

#21836 — Re: Daemonization / Popen / pipe issue

FromLee Clemens <java@leeclemens.net>
Date2012-03-17 18:17 -0400
SubjectRe: Daemonization / Popen / pipe issue
Message-ID<mailman.766.1332022695.3037.python-list@python.org>
On 03/16/2012 11:37 PM, John O'Hagan wrote:
> On Fri, 16 Mar 2012 22:12:14 -0400
> Lee Clemens <java@leeclemens.net> wrote:
>
>> I have a multi-threaded application
>>
>> I have provided a test-case here: https://gist.github.com/2054194
> I haven't looked at your test case yet, but a possible cause is the fact that
> the main application (or main thread) exits if it has finished executing and
> only daemon threads remain. This can  abruptly terminate threads which may be
> busy, for example, communicating via a pipe. The best solution IMO is not to
> use daemon threads, but to give all threads a way to terminate cleanly before
> the main thread does, even if this means using a flag or the like.
>
> HTH,
>
> John
>
I call .join() on each spawned thread, whether it is daemonized or not.
The code is available here:

https://gist.github.com/2054194


Is it generally not recommended to daemonize Python applications using
this method? Do you have any references or data to support your opinion?
Do you have any references which specifically state - "Daemonizing
Python applications cause Python to work in unexpected ways."? As that
is what seems to be happening - data corrupting pipe redirection at an
underlying level....

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web