Skip to content

[PR #10923/19643c9c backport][3.12] Fix weakref garbage collection race condition in DNS resolver manager #10924

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

patchback[bot]
Copy link
Contributor

@patchback patchback bot commented May 21, 2025

This is a backport of PR #10923 as merged into master (19643c9).

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().

Copy link

codecov bot commented May 21, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.15%. Comparing base (761a16c) to head (64fb492).
Report is 2 commits behind head on 3.12.

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             3.12   #10924   +/-   ##
=======================================
  Coverage   98.14%   98.15%           
=======================================
  Files         130      130           
  Lines       39279    39302   +23     
  Branches     2220     2222    +2     
=======================================
+ Hits        38552    38575   +23     
  Misses        554      554           
  Partials      173      173           
Flag Coverage Δ
CI-GHA 98.04% <100.00%> (+<0.01%) ⬆️
OS-Linux 97.76% <100.00%> (+<0.01%) ⬆️
OS-Windows 95.22% <100.00%> (-0.01%) ⬇️
OS-macOS 96.93% <100.00%> (-0.01%) ⬇️
Py-3.10.11 96.82% <100.00%> (+<0.01%) ⬆️
Py-3.10.17 97.36% <100.00%> (+<0.01%) ⬆️
Py-3.11.12 97.46% <100.00%> (-0.01%) ⬇️
Py-3.11.9 96.92% <100.00%> (+<0.01%) ⬆️
Py-3.12.10 97.83% <100.00%> (+<0.01%) ⬆️
Py-3.13.3 97.82% <100.00%> (-0.01%) ⬇️
Py-3.9.13 96.70% <100.00%> (+<0.01%) ⬆️
Py-3.9.22 97.23% <100.00%> (+<0.01%) ⬆️
Py-pypy7.3.16 87.61% <100.00%> (-1.13%) ⬇️
VM-macos 96.93% <100.00%> (-0.01%) ⬇️
VM-ubuntu 97.76% <100.00%> (+<0.01%) ⬆️
VM-windows 95.22% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

codspeed-hq bot commented May 21, 2025

CodSpeed Performance Report

Merging #10924 will not alter performance

Comparing patchback/backports/3.12/19643c9cfe734ced3d2a821aa53c7f30c737a097/pr-10923 (64fb492) with 3.12 (761a16c)

Summary

✅ 59 untouched benchmarks

@bdraco bdraco merged commit 2e51f40 into 3.12 May 21, 2025
36 checks passed
@bdraco bdraco deleted the patchback/backports/3.12/19643c9cfe734ced3d2a821aa53c7f30c737a097/pr-10923 branch May 21, 2025 23:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant