cpython: Issue #11393: Fix faulthandler_thread(): release cancel lock before join lock
http://hg.python.org/cpython/rev/8b1341d51fe6 changeset: 69095:8b1341d51fe6 user: Victor Stinner <victor.stinner@haypocalc.com> date: Fri Apr 01 02:28:22 2011 +0200 summary: Issue #11393: Fix faulthandler_thread(): release cancel lock before join lock If the thread releases the join lock before the cancel lock, the thread may sometimes still be alive at cancel_dump_tracebacks_later() exit. So the cancel lock may be destroyed while the thread is still alive, whereas the thread will try to release the cancel lock, which just crash. Another minor fix: the thread doesn't release the cancel lock if it didn't acquire it. files: Modules/faulthandler.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Modules/faulthandler.c b/Modules/faulthandler.c --- a/Modules/faulthandler.c +++ b/Modules/faulthandler.c @@ -401,6 +401,7 @@ thread.timeout_ms, 0); if (st == PY_LOCK_ACQUIRED) { /* Cancelled by user */ + PyThread_release_lock(thread.cancel_event); break; } /* Timeout => dump traceback */ @@ -419,7 +420,6 @@ /* The only way out */ thread.running = 0; PyThread_release_lock(thread.join_event); - PyThread_release_lock(thread.cancel_event); } static void -- Repository URL: http://hg.python.org/cpython
participants (1)
-
victor.stinner