Core concepts, architecture and lifecycle implies two streams created from one RPC method
- Dominant language
- HTML
- Stars
- 479
- Forks
- 545
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 5
Description
Here is an extract from https://grpc.io/docs/what-is-grpc/core-concepts/
```
Bidirectional streaming RPCs where both sides send a sequence of messages using a read-write stream. The **two** streams operate independently, so clients and servers can read and write in whatever order they like
...
Client- and server-side stream processing is application specific. Since the **two** streams are independent, the client and server can read and write messages in any order.
```
I understand that there are two logical streams of data in a bidirectional RPC but I think it is important not to confuse this with the one underlying gRPC/HTTP2 stream. I think the documentation should be changed to
```
Bidirectional streaming RPCs where both sides send a sequence of messages using a read-write stream. **Both sides of the bidirectional gRPC stream** operate independently, so clients and servers can read and write in whatever order they like
...
Client- and server-side stream processing is application specific. Since **both directions of the gRPC** streams are independent, the client and server can read and write messages in any order.
```
I think this distinction is important because I have been trying to resolve an issue like [6568 ](https://github.com/grpc/grpc-java/issues/6568). The service definition is 'rpc clientNotifies(stream StreamEvent) returns (Empty); The Java client closes its side of the stream first but gets an 'onError' callback with 'CANCELLED: RST_STREAM closed stream. HTTP/2 error code: CANCEL' after the server closes its side using
```
@Override
public void onCompleted() {
log.info("onCompleted: client-to-server half-stream closed, now closing server-to-client half-stream");
responseObserver.onCompleted();
}
```
The server logs
WARNING: Cancelling the stream with status Status{code=INTERNAL, description=Completed without a response, cause=null}
As per [6568 ](https://github.com/grpc/grpc-java/issues/6568), the warning and error message is avoided by the server sending an Empty message when the stream begins.
I was wondering if
- the server sending a useless Empty message back to the client resulted in the creation of a new gRPC stream. (I think it does not. but mention of two streams above put this in doubt)
- in order to free resources, the server would need to call 'responseObserver.onCompleted();' if it never sent an Empty message
Contributor guide
Assessment
This issue has not been assessed yet.