-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SIGSEGV/SIGABRT in PyEval_RestoreThread #127893
Comments
The GC is a red herring. The problem is that Python shutdown while daemon threads are running isn't safe. (GC is called during the shutdown process, but the GC itself isn't the problem). The relevant line in the stack trace is:
Basically, what's happening is that the main thread, as part of the shutdown process, deletes the See also: |
Thanks for the quick response @colesbury! Your description was very clear (and it makes a great deal of sense). I read through some of the linked tickets referenced in #124878... seems like this issue (or some variant of it) has been around for a while. Is there a particular range of cpython versions you'd expect to be subject to this issue (or, inversely, is there a set of releases which you believe would not have this problem)? Based on the references here is seems like the answer is "no, something like this has existed for a while" but it seemed worth confirming. |
This has been around since at least Python 3.9. Older Python versions may have different shutdown related crashes.
I'd like to see it fixed in the upcoming 3.14 release. |
Thanks again @colesbury! I'll very much leave this up to you and the other core Python folks as to whether this ticket stays open. To my eyes this seems to describe a condition that's already pretty well-documented without contributing a whole lot of new context. If you agree I'm perfectly fine with closing this ticket out with the understanding that this will be fixed when something is put in place for the other issues. But if this offers something new I have no objection to leaving it open. It's entirely up to you. :) |
Bug report
Bug description:
Reported by a customer; we haven't reproduced this yet internally but we're trying to do so.
Customer has an app which frequently invokes Apache Cassandra's cqlsh to update data. This update generally succeeds but on rare (and apparently random) occasions the operation fails with a SIGSEGV or SIGABRT in Python. To begin with a few critical stats:
The SIGSEGV case usually looks something like the following:
The SIGABRT case looks something like this:
In all cases we've seen there are two threads running at any one time; one is responsible for the call to PyEval_RestoreThread and the other looks to be a GC thread. Since most (all?) of the core dumps appear to involve the accesses to members of various structures in ceval_gil.h I couldn't help but wonder if GC was somehow stomping on thread information prematurely. But that's entirely speculation on my part; I've spent very little time with the interpreter code base so the GC op could be completely unrelated.
CPython versions tested on:
3.11
Operating systems tested on:
Linux
The text was updated successfully, but these errors were encountered: