Skip to content

stream: Fix default data won't be received issue#208

Merged
lifupan merged 2 commits intocontainerd:masterfrom
Tim-Zhang:fix-stream-recv-default-data
Aug 18, 2023
Merged

stream: Fix default data won't be received issue#208
lifupan merged 2 commits intocontainerd:masterfrom
Tim-Zhang:fix-stream-recv-default-data

Conversation

@Tim-Zhang
Copy link
Copy Markdown
Member

@Tim-Zhang Tim-Zhang commented Aug 9, 2023

Protobuf encodes default values, e.g., 0 for number, "" for string, as empty payload and we wouldn't send empty payload to a receiver.

This commit change the method of empty message detecting.

Fixes #169
Fixes #207

@Tim-Zhang Tim-Zhang requested a review from wllenyj August 9, 2023 13:31
@codecov
Copy link
Copy Markdown

codecov bot commented Aug 9, 2023

Codecov Report

Patch coverage has no change and project coverage change: -0.07% ⚠️

Comparison is base (3ef0e4e) 24.42% compared to head (e16aa7b) 24.35%.
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #208      +/-   ##
==========================================
- Coverage   24.42%   24.35%   -0.07%     
==========================================
  Files          16       16              
  Lines        2645     2652       +7     
==========================================
  Hits          646      646              
- Misses       1999     2006       +7     
Files Changed Coverage Δ
src/asynchronous/client.rs 0.00% <0.00%> (ø)
src/asynchronous/server.rs 0.00% <0.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jsturtevant
Copy link
Copy Markdown
Collaborator

would it be worth adding a message to the example that validates this? Sounds like it is pretty easy to replicate by passing 0's here

sum: 392,
num: 4,
?

Tim-Zhang added a commit to Tim-Zhang/ttrpc-rust that referenced this pull request Aug 10, 2023
And verify containerd#208

Signed-off-by: Tim Zhang <tim@hyper.sh>
@Tim-Zhang Tim-Zhang requested a review from jsturtevant August 10, 2023 06:15
@Tim-Zhang
Copy link
Copy Markdown
Member Author

@jsturtevant Good suggestion, I've just finished it and please help to review it again, thanks

Protobuf encodes default values, e.g., 0 for number, "" for string,
as empty payload and we wouldn't send empty payload to a receiver.

This commit change the method of empty message detecting.

Fixes containerd#169
Fixes containerd#207

Signed-off-by: Tim Zhang <tim@hyper.sh>
Tim-Zhang added a commit to Tim-Zhang/ttrpc-rust that referenced this pull request Aug 10, 2023
Add test for issues: containerd#169, containerd#207

Signed-off-by: Tim Zhang <tim@hyper.sh>
@Tim-Zhang Tim-Zhang force-pushed the fix-stream-recv-default-data branch from 5884e9a to 2678850 Compare August 10, 2023 06:27
Copy link
Copy Markdown
Collaborator

@jsturtevant jsturtevant left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Copy Markdown
Collaborator

@wllenyj wllenyj left a comment

Choose a reason for hiding this comment

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

Thanks, LGTM

Copy link
Copy Markdown

@studychao studychao left a comment

Choose a reason for hiding this comment

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

LGTM but only one small nit


#[cfg(unix)]
async fn divide_stream(cli: streaming_ttrpc::StreamingClient) {
let mut stream = cli
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit: Could we create a test case to test the default value specifically instead of messing it into divide_stream?

Copy link
Copy Markdown
Member Author

@Tim-Zhang Tim-Zhang Aug 14, 2023

Choose a reason for hiding this comment

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

A new case was added instead of modifying one of the exists.

Add test for issues: containerd#169, containerd#207.

Signed-off-by: Tim Zhang <tim@hyper.sh>
@Tim-Zhang Tim-Zhang force-pushed the fix-stream-recv-default-data branch from 2678850 to e16aa7b Compare August 14, 2023 09:20
@Tim-Zhang Tim-Zhang requested a review from studychao August 14, 2023 09:28
@lifupan lifupan merged commit 842864d into containerd:master Aug 18, 2023
@Tim-Zhang Tim-Zhang deleted the fix-stream-recv-default-data branch August 21, 2023 01:47
Tim-Zhang added a commit to Tim-Zhang/ttrpc-rust that referenced this pull request Aug 22, 2023
Cut the release for containerd#196, containerd#197, containerd#200, containerd#203, containerd#208

Signed-off-by: Tim Zhang <tim@hyper.sh>
@Tim-Zhang Tim-Zhang mentioned this pull request Aug 22, 2023
KarstenB pushed a commit to KarstenB/ttrpc-rust that referenced this pull request May 1, 2025
Add test for issues: containerd#169, containerd#207.

Signed-off-by: Tim Zhang <tim@hyper.sh>
KarstenB pushed a commit to KarstenB/ttrpc-rust that referenced this pull request May 1, 2025
…ult-data

stream: Fix default data won't be received issue
KarstenB pushed a commit to KarstenB/ttrpc-rust that referenced this pull request May 1, 2025
Cut the release for containerd#196, containerd#197, containerd#200, containerd#203, containerd#208

Signed-off-by: Tim Zhang <tim@hyper.sh>
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.

Connection lost when sending i32 with value 0 in stream ttrpc Empty Proto Hangs Server Streaming RPC

5 participants