spring-projects / spring-projects/spring-grpc

Server closed the stream without sending trailers when using tomcat

Open
#131 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug status: waiting-on-fix-grpc-java
Dominant language
Java
Stars
413
Forks
95
Avg merge
4d 6h
Merged PRs (30d)
2

Description

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: https://github.com/grpc/grpc-java/issues/10124

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the samples/grpc-server and samples/grpc-tomcat applications, using the empty streamHello implementation shown in the issue. Run the grpcurl commands against both samples and compare the response headers and trailers. Done means the Tomcat sample completes the empty stream with gRPC trailers and grpcurl reports no internal error.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.