Skip to content

fix(rust): clean up pending requests on cancellation - #566

Merged
Connor Peet (connor4312) merged 1 commit into
microsoft:mainfrom
redsun82:redsun82-special-journey
Nov 6, 2026
Merged

Connor Peet (connor4312) merged 1 commit into
microsoft:mainfrom
redsun82:redsun82-special-journey

Conversation

@redsun82

Copy link
Copy Markdown
Contributor

Dropping a Rust request future leaves its pending entry behind when the peer stays silent. Use an RAII guard to remove the entry synchronously, including while outbound admission is blocked, without changing timeout/error behavior or the wire protocol.

Regression tests cover cancellation, continued client usability, late replies, and response/shutdown races. All 87 client tests/doctests pass.

Overlaps with the pending-request cleanup in #490; this isolates that fix from the broader lifecycle changes.

Closes #565

Co-authored-by: Copilot <[email protected]>
Copilot-Session: e58983b66a4340038f1e6ef1a2852f6a

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are identified for the Rust request-cancellation cleanup change.

No open issues 🎉

What changed in this PR

Fixes Rust client pending-request leaks when callers drop or abort request futures, addressing #565 without changing the wire protocol or existing timeout and error behavior.

Changes:

  • Adds a drop guard and synchronous pending-map locking so cancellation cleans up entries, including while outbound admission is blocked.
  • Adds regression tests for cancellation, late replies, continued client usability, error handling, and response/shutdown races.
  • Adds a Rust-only changelog fragment.
File Description
docs/​.changes/​20261105-rust-request-cancellation-cleanup.json Records the cancellation cleanup fix for Rust consumers.
clients/​rust/​crates/​ahp/​src/​client/​tests.rs Tests pending-entry cleanup and preserved client behavior.
clients/​rust/​crates/​ahp/​src/​client.rs Adds drop-based cleanup and updates pending-map locking.

Review effort: Balanced

@connor4312 Connor Peet (connor4312) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@connor4312
Connor Peet (connor4312) enabled auto-merge (squash) November 5, 2026 16:31
@connor4312
Connor Peet (connor4312) merged commit fc1eabf into microsoft:main Nov 6, 2026
9 checks passed
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.

Rust client: dropped request futures leak pending entries

5 participants