spring-projects / spring-projects/spring-grpc
Server closed the stream without sending trailers when using tomcat
Nobody has claimed this yet.
- 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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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