STINNER Victor added the comment:

At the first CTRL+c, the main thread exit and enters Py_Finalize() which calls 
wait_for_thread_shutdown() (in Python: threading._shutdown()).

The problem is that the second call interrupted threading._shutdown() (still in 
the main thread).

> #9  0x000000000043d1d5 in PyGC_Collect () at Modules/gcmodule.c:1604
> #10 0x000000000041e959 in Py_Finalize () at Python/pythonrun.c:605

At this point, we can expect that only one Python thread is running because 
wait_for_thread_shutdown() has been called, but there are between 2 and 9 
running Python threads.

If wait_for_thread_shutdown() is interrupted, maybe Python should kill all 
other threads with pthread_kill() or something like that.

Or wait_for_thread_shutdown() should maybe block SIGINT and SIGTERM signals 
using pthread_sigmark()?

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue20526>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to