containerd / ttrpc-rust

Rust implementation of ttrpc (GRPC for low-memory environments)
Apache License 2.0
195 stars 45 forks source link

Connection lost when sending i32 with value 0 in stream ttrpc #207

Closed studychao closed 1 year ago

studychao commented 1 year ago

Description of problem

If we set proto like this in stream (take the example from : https://github.com/containerd/ttrpc-rust/blob/master/example/protocols/protos/streaming.proto)

rpc DivideStream(Sum) returns (stream Part);

If the Sum here contains i32 like

message Sum {
    int32 sum = 1;
    int32 num = 2;
}

and that all i32 values (sum and num) are 0. ⚠️To reproduce the problem, all i32 must be 0, if only sum is 0 or num is 0, then the connection will not lost

In the above case, the connection must be lost. The client side won't return any error and the server side won't receive anything.

This is pretty easy to reproduce, you can change https://github.com/containerd/ttrpc-rust/blob/555c412130e06d9c5632927e7bb7a1a4ed1ca774/example/async-stream-client.rs#L124-L125 sum and num value to 0, and then run the example, then you could find out that server side could not receiver the message

Expected result

server side receive the message

Actual result

The client side won't return any error and the server side won't receive anything.

powturns commented 1 year ago

I believe this is the same issue as described here: https://github.com/containerd/ttrpc-rust/issues/169 I'm happy to have it fixed in the rust implementation, but this will be a change in behaviour compared to the golang implementation.

Tim-Zhang commented 1 year ago

duplicate of #169