Skip to content
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

Fix "Exception ignored" in weakref callback during interpreter shutdown. #174

Merged

Conversation

projectgus
Copy link
Contributor

Closes #173. Under some circumstances "Exception ignored in: <function WeakMethod.new.._cb at 0x770cbdb5b9c0>" appears during interpreter shutdown.

Root cause is probably a weakref callback running here from an interpeter shutdown finalizer pass, and then calling _disconnect either causes the same weakref to be cleaned up again or calls into some other already-gone resource and triggers the error.

No test is added for this, as noted in the linked issue it seems to only appear under some particular ordering of finalizers. However, there should be minimal risk of regressions as sys.is_finalizing() is only set when the Python environment is going away.

Thanks for all your work on blinker!

@davidism davidism added this to the 1.9.0 milestone Nov 8, 2024
Under some circumstances "Exception ignored in: <function
WeakMethod.__new__.<locals>._cb at 0x770cbdb5b9c0>" appears during interpreter shutdown.

Root cause is probably a weakref callback running here from an interpeter shutdown
finalizer pass, and then calling _disconnect either causes the same weakref to be
cleaned up again or calls into some other already-gone resource and triggers the error.
@davidism davidism force-pushed the bugfix/weakref_disconnect_shutdown branch from 18cdd75 to 42561fd Compare November 8, 2024 16:51
@davidism davidism merged commit 16e4bd7 into pallets-eco:main Nov 8, 2024
8 checks passed
@projectgus projectgus deleted the bugfix/weakref_disconnect_shutdown branch November 9, 2024 00:55
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Exceptions (ignored) in finalizers running during interpreter shutdown
2 participants