classification
Title: add note/warning about daemon threads
Type: behavior Stage: resolved
Components: Documentation Versions: Python 3.2, Python 3.3, Python 3.4, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, pitrou, python-dev, sbt, tim.golden
Priority: normal Keywords:

Created on 2013-02-15 09:24 by pitrou, last changed 2013-02-15 20:36 by pitrou. This issue is now closed.

Messages (5)
msg182133 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-02-15 09:24
People are generally not aware of the properties of daemon threads.
I suggest to add a note such as the following:

« Daemon threads are abruptly stopped at shutdown. Their resources (such as open files, database transactions, etc.) may not be released properly. If you want your threads to stop gracefully, make them non-daemonic and use a suitable signalling mechanism such as an Event. »
msg182135 - (view) Author: Tim Golden (tim.golden) * (Python committer) Date: 2013-02-15 09:28
+1 This is essentially the answer to the naive user's question:

"Why would anyone *not* use daemon threads given that they're less
hassle to manage?"
msg182167 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-02-15 20:30
New changeset e63c4bc81d9f by Antoine Pitrou in branch '2.7':
Issue #17208: add a note about the termination behaviour of daemon threads.
http://hg.python.org/cpython/rev/e63c4bc81d9f
msg182169 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-02-15 20:35
New changeset 8753a3be4a3c by Antoine Pitrou in branch '3.2':
Issue #17208: add a note about the termination behaviour of daemon threads.
http://hg.python.org/cpython/rev/8753a3be4a3c

New changeset 917ae89e59ce by Antoine Pitrou in branch '3.3':
Issue #17208: add a note about the termination behaviour of daemon threads.
http://hg.python.org/cpython/rev/917ae89e59ce

New changeset 8b85f10b5341 by Antoine Pitrou in branch 'default':
Issue #17208: add a note about the termination behaviour of daemon threads.
http://hg.python.org/cpython/rev/8b85f10b5341
msg182170 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2013-02-15 20:36
Committed.
History
Date User Action Args
2013-02-15 20:36:07pitrousetstatus: open -> closed
resolution: fixed
messages: + msg182170

stage: resolved
2013-02-15 20:35:51python-devsetmessages: + msg182169
2013-02-15 20:30:38python-devsetnosy: + python-dev
messages: + msg182167
2013-02-15 09:28:14tim.goldensetnosy: + tim.golden
messages: + msg182135
2013-02-15 09:24:39pitroucreate