-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Fix weakref garbage collection race condition in DNS resolver manager #10923
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
Conversation
Fix `AttributeError: NoneType object has no attribute cancel` in DNS resolver cleanup Downstream users reported a crash during test teardown with the following error: ``` AttributeError: NoneType object has no attribute cancel ``` The issue occurs in `_DNSResolverManager.release_resolver()` when the weakref-managed resolver object gets garbage collected before it can be properly cancelled. This creates a race condition where the resolver reference becomes `None` but the cleanup code still tries to call `resolver.cancel()`.
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## master #10923 +/- ##
=======================================
Coverage 98.75% 98.75%
=======================================
Files 129 129
Lines 39072 39095 +23
Branches 2164 2166 +2
=======================================
+ Hits 38586 38609 +23
Misses 337 337
Partials 149 149
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
CodSpeed Performance ReportMerging #10923 will not alter performanceComparing Summary
|
Backport to 3.12: 💚 backport PR created✅ Backport PR branch: Backported as #10924 🤖 @patchback |
…ce condition in DNS resolver manager (#10924) Co-authored-by: J. Nick Koston <[email protected]>
Fix
AttributeError: NoneType object has no attribute cancel
in DNS resolver cleanupDownstream users reported a crash during test teardown with the following error:
The issue occurs in
_DNSResolverManager.release_resolver()
when the weakref-managed resolver object gets garbage collected before it can be properly cancelled. This creates a race condition where the resolver reference becomesNone
but the cleanup code still tries to callresolver.cancel()
.