containerd / ttrpc-rust

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

Empty Proto Hangs Server Streaming RPC #169

Closed powturns closed 1 year ago

powturns commented 1 year ago

Description of problem

If a client makes a request to a server streaming RPC (eg: rpc DivideStream(Sum) returns (stream Part);) using a default request (eg: streaming::Sum { ..Default::default() }), the call hangs indefinitely. This can easily be observed by modifying the async-stream-client example to send an empty Sum

The root cause is twofold:

  1. Empty / Default proto messages serialize to an empty vector
  2. The server implementation does not attempt to deliver an empty payload (I think because it assumes it will be receiving DATA messages soon, but the client sends only the request).

Expected result

The server processes the request and returns the stream to the client.

Actual result

The server does not execute the corresponding method. The client waits indefinitely for a response.

powturns commented 1 year ago

It's not very clear to me from the spec if a request with no payload is valid.

It looks like the go implementation does a similar thing, and also hangs indefinitely if an empty Sum is sent.

wllenyj commented 1 year ago

Thanks, @powturns. We can discuss fix proposals in the golang version, and if there is progress we will make a sync fix.