This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients CyberJacob, Decorater, Matt Groth, ellisj, eric.araujo, lazka, mwh, ncoghlan, pitrou, tiagoaoa, tim.peters, undercoveridiot, vlasovskikh, vstinner
Date 2019-05-23.12:46:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1558615586.11.0.259149014417.issue1230540@roundup.psfhosted.org>
In-reply-to
Content
There is a special case. If a thread calls os.fork() and Thread.run() raises an exception, the thread name is still logged even if there is only 1 thread after fork. Try attached fork_thread.py.

Output on Python 3.7:
---
main thread: spawn fork thread
thread: before fork [<_MainThread(MainThread, started 140623217481536)>, <ForkThread(Thread-1, started 140622996952832)>]
thread: after fork [<ForkThread(Thread-1, started 140622996952832)>]
thread: after fork: raise
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib64/python3.7/threading.py", line 917, in _bootstrap_inner
    self.run()
  File "fork_thread.py", line 17, in run
    raise Exception("what happens here?")
Exception: what happens here?

main thread: done
---

Moreover, threading.Thread silently ignores SystemExit in run() even if it's the only remaining thread (main thread is gone after fork).

I don't think that we *have to* change the current behavior. It's just that we have to take it in account if we modify how exceptions are handled.
History
Date User Action Args
2019-05-23 12:46:26vstinnersetrecipients: + vstinner, mwh, tim.peters, ncoghlan, ellisj, pitrou, tiagoaoa, eric.araujo, undercoveridiot, vlasovskikh, lazka, Decorater, CyberJacob, Matt Groth
2019-05-23 12:46:26vstinnersetmessageid: <1558615586.11.0.259149014417.issue1230540@roundup.psfhosted.org>
2019-05-23 12:46:26vstinnerlinkissue1230540 messages
2019-05-23 12:46:25vstinnercreate