Summary
ConnectionClosed::poll appends a cloned Waker on every pending poll without replacement or deduplication: connection.rs.
The driver invokes this on every connection poll while not draining: driver.rs. Handshake and stream-opening lists use similar append-only vectors.
Impact
A long-lived active connection retains another Waker for every driver poll until close. Cancelled futures leave stale Wakers, and close may eventually wake a very large list.
Suggested fix
Use AtomicWaker for single waiters or a cancellation-safe/deduplicated collection for multiple tasks. Add a test that repeatedly polls pending state with the same Waker and asserts stable waiter count.
Summary
ConnectionClosed::pollappends a cloned Waker on every pending poll without replacement or deduplication:connection.rs.The driver invokes this on every connection poll while not draining:
driver.rs. Handshake and stream-opening lists use similar append-only vectors.Impact
A long-lived active connection retains another Waker for every driver poll until close. Cancelled futures leave stale Wakers, and close may eventually wake a very large list.
Suggested fix
Use
AtomicWakerfor single waiters or a cancellation-safe/deduplicated collection for multiple tasks. Add a test that repeatedly polls pending state with the same Waker and asserts stable waiter count.