Skip to content

Server closed the stream without sending trailers when using tomcat #131

Open
@mvazquezrius

Description

@mvazquezrius

I have tested a modified version of the grpc-server and grpc-tomcat samples, where I change the streamHello implementation to an empty response:

@Override
public void streamHello(HelloRequest req, StreamObserver<HelloReply> responseObserver) {
	log.info("Hello " + req.getName());
	responseObserver.onCompleted();
}

With the grpc-server, everything works well:

grpcurl -vv -d '{"name":"Hi"}' -plaintext localhost:9090 Simple.StreamHello

Resolved method descriptor:
rpc StreamHello ( .HelloRequest ) returns ( stream .HelloReply );

Request metadata to send:
(empty)

Response headers received:
(empty)

Response trailers received:
content-type: application/grpc
Sent 1 request and received 0 responses
Timing Data: 22.73575ms
  Dial: 12.639834ms
    BlockingDial: 12.606ms
  InvokeRPC: 9.261834ms

But with tomcat the trailers are not sent:

grpcurl -vv -d '{"name":"Hi"}' -plaintext localhost:9090 Simple.StreamHello

Resolved method descriptor:
rpc StreamHello ( .HelloRequest ) returns ( stream .HelloReply );

Request metadata to send:
(empty)

Response headers received:
content-length: 0
content-type: application/grpc
date: Thu, 06 Mar 2025 18:34:11 GMT

Response trailers received:
(empty)
Sent 1 request and received 0 responses
ERROR:
  Code: Internal
  Message: server closed the stream without sending trailers

Related: grpc/grpc-java#10124

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions