Message402219
I don't think that there is a "good default behavior" where Python currently calls PyThread_exit_thread().
IMO we should take the problem from the other side and tries to reduce cases when Python can reach this case. Or even make it impossible if possible. For example, *removing* daemon threads would remove the most common case when Python has to call PyThread_exit_thread().
I'm not sure how to make this case less likely when threading._shutdown() is interrupted by CTRL+C. This function can likely hang if a thread is stuck for whatever reason. It's important than an user is able to "interrupt" or kill a stuck process with CTRL+C (SIGINT). It's a common expectation on Unix, at least for me.
Maybe threading._shutdown() should be less nice and call os._exit() in this case: exit *immediately* the process in this case. Or Python should restore the default SIGINT handler: on Unix, the default SIGINT handler immediately terminate the process (like os._exit() does).
I don't think that abort() should be called here (raise SIGABRT signal), since the intent of an user pressing CTRL+C is to silently terminate the process. It's not an application bug, but an user action. |
|
Date |
User |
Action |
Args |
2021-09-20 10:40:41 | vstinner | set | recipients:
+ vstinner, gregory.p.smith, izbyshev, jbms |
2021-09-20 10:40:41 | vstinner | set | messageid: <1632134441.24.0.570889614728.issue42969@roundup.psfhosted.org> |
2021-09-20 10:40:41 | vstinner | link | issue42969 messages |
2021-09-20 10:40:41 | vstinner | create | |
|