Skip to content

Fix spurious "Future exception was never retrieved" warning on disconnect during backpressure#12307

Open
availov wants to merge 5 commits intoaio-libs:masterfrom
availov:warning_on_disconnect_during_backpressure
Open

Fix spurious "Future exception was never retrieved" warning on disconnect during backpressure#12307
availov wants to merge 5 commits intoaio-libs:masterfrom
availov:warning_on_disconnect_during_backpressure

Conversation

@availov
Copy link
Copy Markdown

@availov availov commented Apr 1, 2026

What do these changes do?

In BaseProtocol._drain_helper() we replaced await asyncio.shield(waiter) with plain await waiter.
Since each connection is handled by a single task, the shield didn't provide any benefit and prevented proper cancellation of the waiter future.

Now the future is cancelled cleanly and no spurious warning is logged.

Are there changes in behavior for the user?

No.

Is it a substantial burden for the maintainers to support this?

No, this is a very small and localized change.

Related issue number

Fixes #12281

@psf-chronographer psf-chronographer bot added the bot:chronographer:provided There is a change note present in this PR label Apr 1, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.10%. Comparing base (bced1bc) to head (e77bc31).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #12307      +/-   ##
==========================================
- Coverage   99.11%   99.10%   -0.01%     
==========================================
  Files         130      130              
  Lines       45558    45589      +31     
  Branches     2404     2405       +1     
==========================================
+ Hits        45156    45183      +27     
- Misses        272      275       +3     
- Partials      130      131       +1     
Flag Coverage Δ
CI-GHA 98.96% <100.00%> (-0.01%) ⬇️
OS-Linux 98.71% <100.00%> (-0.02%) ⬇️
OS-Windows 96.99% <100.00%> (+<0.01%) ⬆️
OS-macOS 97.87% <100.00%> (-0.02%) ⬇️
Py-3.10.11 97.42% <100.00%> (+<0.01%) ⬆️
Py-3.10.20 97.89% <100.00%> (-0.01%) ⬇️
Py-3.11.15 98.10% <100.00%> (+<0.01%) ⬆️
Py-3.11.9 97.63% <100.00%> (+<0.01%) ⬆️
Py-3.12.10 97.72% <100.00%> (-0.01%) ⬇️
Py-3.12.13 98.19% <100.00%> (+<0.01%) ⬆️
Py-3.13.12 98.44% <100.00%> (+<0.01%) ⬆️
Py-3.14.3 98.50% <100.00%> (+<0.01%) ⬆️
Py-3.14.3t 97.50% <100.00%> (-0.01%) ⬇️
Py-pypy3.11.15-7.3.21 97.38% <100.00%> (-0.01%) ⬇️
VM-macos 97.87% <100.00%> (-0.02%) ⬇️
VM-ubuntu 98.71% <100.00%> (-0.02%) ⬇️
VM-windows 96.99% <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.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Apr 1, 2026

Merging this PR will not alter performance

✅ 59 untouched benchmarks


Comparing availov:warning_on_disconnect_during_backpressure (e77bc31) with master (bced1bc)

Open in CodSpeed

@Dreamsorcerer Dreamsorcerer added the backport-3.14 Trigger automatic backporting to the 3.14 release branch by Patchback robot label Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-3.14 Trigger automatic backporting to the 3.14 release branch by Patchback robot bot:chronographer:provided There is a change note present in this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Future exception was never retrieved" spam when request handler is cancelled during write backpressure

2 participants