Skip to content
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

Fix streaming with empty payloads #157

Merged
merged 4 commits into from
Feb 5, 2024
Merged

Conversation

mxpv
Copy link
Member

@mxpv mxpv commented Feb 2, 2024

Fix #126

I found this one while working on containerd/containerd#9704

Was able to reproduce the issue with integration test and applied fix seems to be sufficient to fix the problem.

Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
@mxpv mxpv requested a review from dmcgowan February 2, 2024 20:12
@mxpv mxpv changed the title Fix streaming fix empty payloads Fix streaming with empty payloads Feb 2, 2024
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
@@ -140,7 +140,7 @@ func (s *serviceSet) handle(ctx context.Context, req *Request, respond func(*sta
respond(st, p, stream.StreamingServer, true)
}()

if req.Payload != nil {
if req.Payload != nil || !info.StreamingClient {
Copy link
Member

Choose a reason for hiding this comment

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

Can you add a comment here?
I'm not sure I follow why this fixes the issue.

Copy link
Member Author

Choose a reason for hiding this comment

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

Added 44ca009

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for the comment, I'm not sure how that relates to!info.StreamingClient
I guess this comes down to the info struct not really being documented.

So this is the server side and we are forcing it to deliver the empty payload?

Copy link
Member Author

@mxpv mxpv Feb 3, 2024

Choose a reason for hiding this comment

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

This covers one additional case of client streaming.

This one works:

rpc DivideStream(Sum) returns (stream Part);

However if you change signature to:

rpc DivideStream(google.protobuf.Empty) returns (stream Part);

It won't work, because google.protobuf.Empty translates into nil payload, so the DivideStream call skipped.

Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
@dmcgowan dmcgowan merged commit 90d421e into containerd:main Feb 5, 2024
11 checks passed
@mxpv mxpv deleted the empty_payload branch February 5, 2024 19:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

Empty Proto Hangs Server Streaming RPC
4 participants