Skip to content

Fix flaky DuplexStream_SendToUnimplementedMethod_ThrowError test#2720

Merged
JamesNK merged 1 commit intogrpc:masterfrom
JamesNK:fix/flaky-duplex-stream-unimplemented-test
Apr 23, 2026
Merged

Fix flaky DuplexStream_SendToUnimplementedMethod_ThrowError test#2720
JamesNK merged 1 commit intogrpc:masterfrom
JamesNK:fix/flaky-duplex-stream-unimplemented-test

Conversation

@JamesNK
Copy link
Copy Markdown
Member

@JamesNK JamesNK commented Apr 17, 2026

Fix race condition in DuplexStream_SendToUnimplementedMethod_ThrowError where GetStatus() throws InvalidOperationException because CallTask hasn't completed yet.\n\nThe test was awaiting ResponseHeadersAsync before calling GetStatus(), but receiving response headers doesn't guarantee the internal call is fully complete. The fix drains the response stream (via MoveNext which throws RpcException) before checking status, ensuring the call is fully finished.

Drain the response stream before calling GetStatus() to ensure the
call is fully complete. Previously, there was a race condition where
ResponseHeadersAsync could complete before CallTask finished, causing
GetStatus() to throw InvalidOperationException.
Copy link
Copy Markdown
Member

@asheshvidyut asheshvidyut left a comment

Choose a reason for hiding this comment

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

LGTM

@JamesNK JamesNK merged commit 069019e into grpc:master Apr 23, 2026
6 of 7 checks passed
@JamesNK JamesNK deleted the fix/flaky-duplex-stream-unimplemented-test branch April 23, 2026 06:42
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.

2 participants