Message343293
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. |
|
Date |
User |
Action |
Args |
2019-05-23 12:46:26 | vstinner | set | recipients:
+ vstinner, mwh, tim.peters, ncoghlan, ellisj, pitrou, tiagoaoa, eric.araujo, undercoveridiot, vlasovskikh, lazka, Decorater, CyberJacob, Matt Groth |
2019-05-23 12:46:26 | vstinner | set | messageid: <1558615586.11.0.259149014417.issue1230540@roundup.psfhosted.org> |
2019-05-23 12:46:26 | vstinner | link | issue1230540 messages |
2019-05-23 12:46:25 | vstinner | create | |
|