eclipse-vertx / vertx-grpc

Development of the gRPC component for Eclipse Vert.x
Eclipse Public License 2.0
42 stars 23 forks source link

RST_STREAM frame after some client request #40

Closed lwlee2608 closed 1 year ago

lwlee2608 commented 1 year ago

Using this client code:

client
  .request(server, GreeterGrpc.getSayHelloMethod()).compose(request -> {
    request.end(HelloRequest
      .newBuilder()
      .setName("Bob")
      .build());
    return request.response().compose(response -> response.last());
  }).onSuccess(reply -> {
    System.out.println("Received " + reply.getMessage());
  });

I have observed that RST_STREAM (8) is being sent after each request. However, my understanding of the RST_STREAM frame is that it should only be used when there is an error that prevents the sender or receiver from completing a particular stream.

To confirm my understanding, I also used the older VertxGrpcStub and found no instances of RST_STREAM being used.

I attempted to change request.end() to request.write() but this did not resolve the issue. Is there a way to send a request without including the RST_STREAM frame?

To gain further insights, I also performed a debug session using this unit test to trace the code that produces the RST_STREAM frame. I think it probably comes from here.

vietj commented 1 year ago

thanks, it is a bug in GrpcClientRequestImpl, those reset frames should not be sent.

Netty HTTP/2 server ignores such frames them because their stream existed, I'm expecting other servers do the same.

this will be fixed soon, it should not happen.

lwlee2608 commented 1 year ago

@vietj I've traced the code and found GrpcReadStreamBase.init() -> GrpcClientResponse.handleEnd() is sending the reset frame. Hope it helps.

vietj commented 1 year ago

thanks @lwlee2608 it helped