summaryrefslogtreecommitdiffstats
path: root/Modules/faulthandler.c
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-04-01 00:28:22 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-04-01 00:28:22 (GMT)
commit1c76b7f5e505e370a5e0b840af3002054eda1e0c (patch)
tree26047c6dced9cf6d8d417bc3ddd6010ab86b0abb /Modules/faulthandler.c
parentd6056b7d8d53581748eaacb31e3df23d4adb0561 (diff)
downloadcpython-1c76b7f5e505e370a5e0b840af3002054eda1e0c.zip
cpython-1c76b7f5e505e370a5e0b840af3002054eda1e0c.tar.gz
cpython-1c76b7f5e505e370a5e0b840af3002054eda1e0c.tar.bz2
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.
Diffstat (limited to 'Modules/faulthandler.c')
-rw-r--r--Modules/faulthandler.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/Modules/faulthandler.c b/Modules/faulthandler.c
index e8ed3e8..760689e 100644
--- a/Modules/faulthandler.c
+++ b/Modules/faulthandler.c
@@ -401,6 +401,7 @@ faulthandler_thread(void *unused)
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 @@ faulthandler_thread(void *unused)
/* The only way out */
thread.running = 0;
PyThread_release_lock(thread.join_event);
- PyThread_release_lock(thread.cancel_event);
}
static void