Skip to content

fix(client): release server-streaming start task on pending terminal - #688

Merged
SunSi12138 merged 4 commits into
devfrom
fix/server-streaming-terminal-signal-687
Sep 13, 2026
Merged

SunSi12138 merged 4 commits into
devfrom
fix/server-streaming-terminal-signal-687

Conversation

@SunSi12138

Copy link
Copy Markdown
Owner

Problem

A timed ServerStreaming call observes head-Request emission, but the emission wait uses CancellationToken.None. If the transport write stalls after queue admission, PendingRequestTable can already select DeadlineExceeded (and complete the user-visible dispatcher) while ServerStreamingInvoker remains parked in the framework-task supervisor until the transport recovers.

Change

  • add a small PendingCallTerminalSignal completion-observer wrapper that mirrors the terminal already selected by PendingRequestTable into a framework-only cancellation token;
  • keep the existing completion observer chained through the wrapper, so endpoint/admission accounting still observes the same terminal exactly once;
  • use that token only for timed ServerStreaming head-Request emission waits;
  • dispose the signal source as soon as emission completes normally, so normal stream lifetime does not retain an extra CTS;
  • leave publication and terminal arbitration unchanged: PendingRequestTable remains authoritative, an accepted Request remains transport-owned, and the emission cancellation cannot replace the winning terminal reason.

The signal is intentionally not a producer token: ServerStreaming has no local producer. It represents only pending-call terminal lifetime.

Regression coverage

Adds a deterministic manual-clock/transport-stall test that:

  1. stalls the transport after the ServerStreaming Request has been admitted;
  2. advances the pending deadline;
  3. verifies the consumer observes DeadlineExceeded;
  4. verifies ServerStreamingInvoker leaves the framework supervisor before the transport stall is released; and
  5. releases the transport and verifies the already-admitted Request is emitted before its matching Cancel.

Local SDK execution is intentionally not used; validation is through the repository's existing GitHub Actions workflows.

Fixes #687

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