Repository navigation
Crash when using _Py_DumpTracebackThreads #128400
Description
Activity
- addedtype-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump
on Jan 2, 2025 It's probably because accessing fields on another thread state isn't very safe, especially on free-threading. Maybe we should just make a stop-the-world pause for manual invocation of
faulthandler?Maybe we should just make a stop-the-world pause for manual invocation of faulthandler?
Yes, I think that would make sense.
Reacted by Peter Bierma- added a commit that references this issue
on Jan 2, 2025 @ZeroIntensity - if you're interested in a related follow-up thread safety issue, I think it'd be helpful to make
faulthandleronly dump the current thread's stack when called from a signal handler. Basically, I think we should ignoreall_threads=Truein the free threading build because accessing other thread's stacks while they're running is likely to crash. It's not exactly thread-safe in the default build either, but it mostly works whereas in the free threading build it frequently crashes.Sure, I can do that.
- added a commit that references this issue
on Jan 2, 2025 Even with the GIL, faulthandler is not safe to use in a multi-threaded process: #116008
- added a commit that references this issue
on Jan 3, 2025 @dgrisby, yes, but there's a meaningful difference between "mostly works" and "mostly crashes". We'd like to get to the point where faulthandler works about as reliably in the free threading build as it does in the GIL-enabled build, even if that still has bugs.
This is fixed now
@dgrisby, yes, but there's a meaningful difference between "mostly works" and "mostly crashes". We'd like to get to the point where faulthandler works about as reliably in the free threading build as it does in the GIL-enabled build, even if that still has bugs.
If that meets your use case, I suppose. The environment I work in, we have long-lived services that must not crash. For us, "mostly works" is equivalent to "too dangerous to use".
The intention of my comment was to explain why we are bothering with fixes to faulthandler given it's limitations. I'm not suggesting that you use faulthandler.
- added a commit that references this issue
on Jan 13, 2025
Crash report
What happened?
This will case the interpreter to segfault if built with
--disable-gil --with-pydebug. I've bisected it to this commit:b2afe2a: gh-123924
Using gdb:
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Output from running 'python -VV' on the command line:
Python 3.14.0a0 experimental free-threading build (bisect/bad:b2afe2aae48, Jan 1 2025, 17:09:16) [Clang 19.1.6 (++20241217105838+657e03f8625c-1
exp120241217105944.74)]Linked PRs
faulthandler#128422faulthandler(GH-128422) #128423faulthandlerif the GIL is disabled #128425Py_FatalErroron the free-threaded build #128758