[Python-Dev] Is it a Python bug that the main thread of a process created in a daemon thread is a daemon itself?

Skip Montanaro skip.montanaro at gmail.com
Thu Jun 25 21:18:14 CEST 2015


On Thu, Jun 25, 2015 at 12:23 PM, Elizabeth Shashkova <
elizabeth.shashkova at gmail.com> wrote:

> When I call fork() inside a daemon thread, the main thread in the child
> process has the "daemon" property set to True.


Didn't this (or a similar) topic come up here recently? For reference:

http://bugs.python.org/issue24512

and

https://docs.python.org/3.4/library/multiprocessing.html#contexts-and-start-methods

from which I quote (emphasis mine):

The parent process uses os.fork() to fork the Python interpreter. The child
process, when it begins, is *effectively identical to the parent process*.
All resources of the parent are inherited by the child process. *Note that
safely forking a multithreaded process is problematic*.


So, even if you get past this particular problem, the conventional wisdom
is, "don't do that."

Skip
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20150625/3a5c2538/attachment.html>


More information about the Python-Dev mailing list