[issue30165] faulthandler acquires lock from signal handler, can deadlock while crashing
STINNER Victor
report at bugs.python.org
Wed Apr 26 04:02:55 EDT 2017
STINNER Victor added the comment:
> I _believe_ we always want to use _PyThreadState_UncheckedGet()
faulthandler_dump_traceback() uses PyGILState_GetThisThreadState(). There is a comment to explain why:
/* SIGSEGV, SIGFPE, SIGABRT, SIGBUS and SIGILL are synchronous signals and
are thus delivered to the thread that caused the fault. Get the Python
thread state of the current thread.
PyThreadState_Get() doesn't give the state of the thread that caused the
fault if the thread released the GIL, and so this function cannot be
used. Read the thread local storage (TLS) instead: call
PyGILState_GetThisThreadState(). */
See also test_faulthandler tests, especially tests releasing the GIL:
* test_gil_released()
* test_fatal_error_without_gil()
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30165>
_______________________________________
More information about the Python-bugs-list
mailing list