Message281721
> I suggest thread_PyThread_start_new_thread() raise RuntimeError("can't start thread: finalizing")
Where *exactly*? Py_FinalizeEx() first calls
wait_for_thread_shutdown() and *then* sets _Py_Finalizing to tstate.
Does wait_for_thread_shutdown() complete on this bug?
Note: It's not the first time that I noticed a deadlock around this
code :-/ I recall a silly bug when you press CTRL+c while
wait_for_thread_shutdown() is running.
See for example threading_shutdown_interrupted.py attached to the
issue #20526. Run it and quickly press CTRL+c. Sometime, it does crash
Python with a segfault...
---
haypo@selma$ ./python threading_shutdown_interrupted.py
..........................................................................................................................................................................................................Exception
ignored in: <module 'threading' from
'/home/haypo/prog/python/default/Lib/threading.py'>
Traceback (most recent call last):
File "/home/haypo/prog/python/default/Lib/threading.py", line 1290,
in _shutdown
t.join()
File "/home/haypo/prog/python/default/Lib/threading.py", line 1056, in join
. self._wait_for_tstate_lock()
File "/home/haypo/prog/python/default/Lib/threading.py", line 1072,
in _wait_for_tstate_lock
... elif lock.acquire(block, timeout):
File "threading_shutdown_interrupted.py", line 29, in killer
.. raise KeyboardInterrupt()
KeyboardInterrupt:
^CSegmentation fault (core dumped)
---
Python finalization is a very fragile and complex task :-/ |
|
Date |
User |
Action |
Args |
2016-11-25 14:25:22 | vstinner | set | recipients:
+ vstinner, irmen, eric.smith, methane, pwp333 |
2016-11-25 14:25:22 | vstinner | link | issue28673 messages |
2016-11-25 14:25:21 | vstinner | create | |
|