|
|
0fa7ed |
bpo-44434: Don't call PyThread_exit_thread() explicitly (GH-26758)
|
|
|
0fa7ed |
|
|
|
0fa7ed |
_thread.start_new_thread() no longer calls PyThread_exit_thread()
|
|
|
0fa7ed |
explicitly at the thread exit, the call was redundant.
|
|
|
0fa7ed |
|
|
|
0fa7ed |
On Linux with the glibc, pthread_cancel() loads dynamically the
|
|
|
0fa7ed |
libgcc_s.so.1 library. dlopen() can fail if there is no more
|
|
|
0fa7ed |
available file descriptor to open the file. In this case, the process
|
|
|
0fa7ed |
aborts with the error message:
|
|
|
0fa7ed |
|
|
|
0fa7ed |
"libgcc_s.so.1 must be installed for pthread_cancel to work"
|
|
|
0fa7ed |
|
|
|
0fa7ed |
pthread_cancel() unwinds back to the thread's wrapping function that
|
|
|
0fa7ed |
calls the thread entry point.
|
|
|
0fa7ed |
|
|
|
0fa7ed |
The unwind function is dynamically loaded from the libgcc_s library
|
|
|
0fa7ed |
since it is tightly coupled to the C compiler (GCC). The unwinder
|
|
|
0fa7ed |
depends on DWARF, the compiler generates DWARF, so the unwinder
|
|
|
0fa7ed |
belongs to the compiler.
|
|
|
0fa7ed |
|
|
|
0fa7ed |
Thanks Florian Weimer and Carlos O'Donell for their help on
|
|
|
0fa7ed |
investigating this issue.
|
|
|
0fa7ed |
|
|
|
0fa7ed |
https://github.com/python/cpython/commit/45a78f906d2d5fe5381d78466b11763fc56d57ba
|
|
|
0fa7ed |
|
|
|
0fa7ed |
Resolves: rhbz#1972293
|
|
|
0fa7ed |
|
|
|
0fa7ed |
diff --git a/Modules/_threadmodule.c b/Modules/_threadmodule.c
|
|
|
0fa7ed |
index a13b2e0..8cc035b 100644
|
|
|
0fa7ed |
--- a/Modules/_threadmodule.c
|
|
|
0fa7ed |
+++ b/Modules/_threadmodule.c
|
|
|
0fa7ed |
@@ -1027,7 +1027,10 @@ t_bootstrap(void *boot_raw)
|
|
|
0fa7ed |
nb_threads--;
|
|
|
0fa7ed |
PyThreadState_Clear(tstate);
|
|
|
0fa7ed |
PyThreadState_DeleteCurrent();
|
|
|
0fa7ed |
- PyThread_exit_thread();
|
|
|
0fa7ed |
+
|
|
|
0fa7ed |
+ // bpo-44434: Don't call explicitly PyThread_exit_thread(). On Linux with
|
|
|
0fa7ed |
+ // the glibc, pthread_exit() can abort the whole process if dlopen() fails
|
|
|
0fa7ed |
+ // to open the libgcc_s.so library (ex: EMFILE error).
|
|
|
0fa7ed |
}
|
|
|
0fa7ed |
|
|
|
0fa7ed |
static PyObject *
|