Skip to content

async/client: Fix unary request timeout cleanup - #318

Open
Tim-Zhang wants to merge 1 commit into
masterfrom
fix-317-async-request-timeout
Open

async/client: Fix unary request timeout cleanup#318
Tim-Zhang wants to merge 1 commit into
masterfrom
fix-317-async-request-timeout

Conversation

@Tim-Zhang

Copy link
Copy Markdown
Member

Summary

  • apply one absolute deadline while a unary request waits for the outbound queue and its response
  • remove stream registrations when requests time out or their futures are cancelled
  • discard expired queued requests before writing, while closing connections interrupted during a write to avoid reusing a potentially partial frame
  • propagate writer failures through the writer task result and add focused regression tests

Root cause

The previous timeout only covered waiting for the response after the request entered the outbound queue. A request could therefore outlive its timeout while the queue or socket was blocked, and timed-out or cancelled requests could leave stream registrations behind.

Validation

  • cargo +1.95.0 test --features async
  • cargo +1.95.0 clippy --all-targets --features async -- -D warnings
  • cargo +1.95.0 fmt --all --check
  • git diff --check

Fixes #317

Use one deadline while waiting for both the outbound queue and the
response. Remove stream registrations when requests time out or are
cancelled.

Discard requests that expire before writing. Close the connection when
a timeout or cancellation interrupts an in-progress write because the
frame may be incomplete.

Return writer failures through the task result. Add regression tests
for full queues, response cleanup, queued request timeout errors, and
cancellation during writes.

Fixes: #317

Signed-off-by: Tim Zhang <tim@hyper.sh>
@Tim-Zhang
Tim-Zhang marked this pull request as ready for review August 6, 2026 10:52
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.

async client: request timeout does not cover outbound queue and socket write

1 participant