-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
8.3.4 changed atexit behavior #13021
Comments
Astounding terrifying I fear that the segfault is from a memory layout change and was latent to begin with |
Hows the behavior with assert rewrite disabled |
Are threads involved? There was a discussion here on weird behaviours of atexit handlers in the presence of threads. I'm pretty sure the real answer is that what sqlanydb is doing is black magic of the darkest type, and they simply shouldn't do it - but that may not be much help... |
Exactly my reaction and suspicion. 😰 (I’ll respond to all the qs when I’m back home) |
Before I forget: I tried running with Python 3.12 and it behaves the same way between 3d3ec57 and 40741c4, so it's not a 3.13 thing.
I can confirm that (for posterity, uv is pretty cool for this:
Not knowingly, but who's to say who started some weird background threads?
yes to both :| |
So I've done more pdb-stepping, and I found that there is, in fact, another thread and it's Sentry's From what I can see in the weird segfault traceback and stepping thru the cleanups, it looks like sqlanydb cleans itself completely up in an atexit handler and then somehow, sqlalchemy's cleanup fairies wake up and try to do a clean up too, including a rollback, but the driver is unusable at this point. All this is of no interest to y'all tho – the q is why assert rewriting should cause this to go from an exception to an segfault. 😳 |
This is really bizarre... we can see from the diff that all 40741c4 did was copy some AST objects to preserve their original location. How that relates to the problem at hand is a mystery. 😬 |
Yeah, as @RonnyPfannschmidt noted, 40741c4 has probably nothing to do with my problems directly. But, generally speaking it looks like assert rewriting is having some influence over cleanup such that either:
I somewhat suspect it's rather 1, especially because I hope it ;) since it seems more straightforward. My gut feeling says that the interpreter is in a bit of precarious state at that point in time anyways and I wouldn't bother y'all if I didn't suspect if that might be a more generalizable problem. 🤔 If the other person in the world who uses sqlanydb and SQLAlchemy finds this: I've worked around the problem by passing |
So this is rather bizarre and was also wild to debug/bisect and I don't have an MRE, but maybe someone has an idea.
In a nutshell, due to 40741c4 / #12867), pytest crashes with a SEGFAULT after the tests.
Of course, it's not pytest that's crashing but the bane of my existence: https://github.com/sqlanywhere/sqlanydb
When running on commit 3d3ec57, I get an output like this after my tests already passed:
When running on 40741c4 or later (and
-q -X faulthandler
, I get:Stepping through the debugger unveils its part of atexit handling, which points at this unholy gem: https://github.com/sqlanywhere/sqlanydb/blob/338845cc18256d8b8c9a9b2383c58a196213b151/sqlanydb.py#L541
Anyone any idea? 😳
The text was updated successfully, but these errors were encountered: