grpc-java icon indicating copy to clipboard operation
grpc-java copied to clipboard

servlet: tomcat does not support trailer only

Open hypnoce opened this issue 2 years ago • 1 comments

gRPC version: 1.53.0 gRPC server transport: servlet gRPC client transport: netty

What is your environment?

MacOS 12.4 jdk11

What did you expect to see?

This is a known behaviour where tomcat sends an empty data frame with a end_stream flag instead of a trailer only frame with end_stream flag. While it is a valid http2 behaviour, this is not supported by gRPC who expected end_stream frames to be sent in trailer or trailer-only frame.

What did you see instead?

Internal status error because a data frame is end_stream

Steps to reproduce the bug

The transport tests earlyServerClose_noServerHeaders, earlyServerClose_serverFailure and earlyServerClose_serverFailure_withClientCancelOnListenerClosed reproduce the problem

hypnoce avatar May 03 '23 05:05 hypnoce

Are there plans on when this will be fixed?

mvazquezrius avatar Mar 31 '25 15:03 mvazquezrius

This is going to end up being closed as won't fix. In #12510 I talk about the problems with fixing Tomcat. I do agree Tomcat's behavior is valid, but it seems the only solution that would actually work is to change the clients, and there's simply not enough bandwidth to entertain that idea for the likes of Tomcat. If clients are fixed, then Tomcat's current behavior starts working, so there's really nothing to do on Tomcat in either case.

If you really want to use Tomcat, and for some reason broken deadline handling doesn't bother you, you can use an interceptor like ForceTrailersServerInterceptor in #10125 and place it close to the application.

Some docs will need to be added/updated to warn users, so I'm leaving this open until there's some hope a user would learn that Tomcat is unsupported before they rely on it.

ejona86 avatar Nov 12 '25 23:11 ejona86