Skip to content

grpc: Fix cardinality violations in non-client streaming RPCs. #8385

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

Pranjali-2501
Copy link
Contributor

Fixes #8362
Partially addresses: #7286

In non-client streaming RPCs, the client's SendMsg() method is designed to automatically close the send operation after its initial call. If someone attempts to call Client.SendMsg() twice for non-client streaming RPCs, if will return with error Internal desc = SendMsg called after CloseSend.
To mirror this behavior, the server-side logic has been updated so that calling RecvMsg() more than once for non-client streaming RPCs will now similarly return an Internal error.

RELEASE NOTES:

  • grpc: return status code INTERNAL when client send more than one request in unary and server streaming RPC.

@Pranjali-2501 Pranjali-2501 added this to the 1.74 Release milestone Jun 6, 2025
Copy link

codecov bot commented Jun 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.34%. Comparing base (996aabe) to head (324566b).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8385      +/-   ##
==========================================
- Coverage   82.34%   82.34%   -0.01%     
==========================================
  Files         413      413              
  Lines       40450    40454       +4     
==========================================
+ Hits        33309    33311       +2     
- Misses       5775     5776       +1     
- Partials     1366     1367       +1     
Files with missing lines Coverage Δ
server.go 82.08% <100.00%> (+0.55%) ⬆️
stream.go 81.95% <100.00%> (+0.29%) ⬆️

... and 17 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dfawley dfawley removed their assignment Jun 6, 2025
@dfawley dfawley removed their request for review June 6, 2025 21:16
Copy link
Member

@dfawley dfawley left a comment

Choose a reason for hiding this comment

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

Is it possible to implement all of this in server.go to avoid adding state to the serverStream?

@Pranjali-2501 Pranjali-2501 changed the title grpc: Fix cardinality violations in server streaming RPC. grpc: Fix cardinality violations in non-client streaming RPCs. Jun 11, 2025
@Pranjali-2501
Copy link
Contributor Author

Is it possible to implement all of this in server.go to avoid adding state to the serverStream?

As discussed this with @arjan-bal offline, Cardinality violations can only be detected when messages are being read from the stream. This reading process occurs specifically within the server.RecvMsg() function. Since RecvMsg() is invoked from the user-implemented handler, it's not possible to detect cardinality violations during the initial stream setup phase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cardinality violations in serverside streaming RPC.
4 participants