-
Notifications
You must be signed in to change notification settings - Fork 3.9k
servlet: force always sending end_stream in trailer frame (Fixes #10124) #10125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
c96be19
to
0d0d716
Compare
Hmm... this is a troublesome issue. We might want to fix support for trailers-only with a zero-length data frame following. For the short-term: nice job on this PR. I think it is pretty solid. But I'm not sure we want to go this way. I'm a hesitant to have the transport introduce the headers, because that is changing the RPC semantics and interceptors wouldn't react. A potentially easier workaround in terms of semantics and implementation would be "do this same approach in an interceptor." That way it can be positioned such that other interceptors could add headers if they need to. But it would require applications to use the interceptor. Thoughts? |
0d0d716
to
1cd5746
Compare
True. Now it changes a lot the control flows because we need to wait for the next data frame to ensure to handle headers as trailers if end_stream flag is set and this data frame is empty.
Thanks a lot :)
From what I understood from the gRPC flow, when writeTrailer is called with headerSent=false, that means that no headers were added by any interceptor. Also, some interceptors might decide to directly close the call without calling Now we could add an interceptor at the very beginning of the interceptors chain and implement the |
On server-side, everything looks normal. But on client-side headers appear and those were not seen on server-side. So client-side can then get confused (e.g., a key should have been in headers, but wasn't).
Yes, that is what I was suggesting. I think that should turn out to be really easy. |
1cd5746
to
a617e77
Compare
True, I get the point. The only weird case I can think of is that the client calls
@ejona86 I changed the PR to use a server interceptor. Obviously the transport level test do fail again but the interop tests do pass. Let me know what you think. Also, it cannot run before any global server interceptors. One final limitation are runtime exceptions. Handling them seems to be a bit tricky when not implemented at transport level. |
a61ae5e
to
492f610
Compare
servlet/src/main/java/io/grpc/servlet/ForceTrailersServerInterceptor.java
Outdated
Show resolved
Hide resolved
servlet/src/main/java/io/grpc/servlet/ForceTrailersServerInterceptor.java
Outdated
Show resolved
Hide resolved
import io.grpc.ServerInterceptor; | ||
import io.grpc.Status; | ||
|
||
class ForceTrailersServerInterceptor implements ServerInterceptor { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had thought we'd allow the user to use this themselves. They may need to use it two or more times, between various interceptors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be clear here, I thought we'd make this public
(and so it'd also need an @ExperimentalApi
annotation).
c6f858b
to
3f797f7
Compare
servlet/src/main/java/io/grpc/servlet/ForceTrailersServerInterceptor.java
Outdated
Show resolved
Hide resolved
import io.grpc.ServerInterceptor; | ||
import io.grpc.Status; | ||
|
||
class ForceTrailersServerInterceptor implements ServerInterceptor { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be clear here, I thought we'd make this public
(and so it'd also need an @ExperimentalApi
annotation).
4b0d14f
to
63221e3
Compare
Just need to fix formatting of TomcatInteropTest:
|
@ejona86 Sorry to ping you again. Where do you stand regarding this issue ? |
@ejona86 I put back the initial fix here: hypnoce@2eda56a |
c066d9e
to
f2e72f9
Compare
5a69eb7
to
15542f9
Compare
…#10124) Signed-off-by: hypnoce <[email protected]>
15542f9
to
6713b8d
Compare
@ejona86 Do you still think this PR can be merged ? We are maintaining a gRPC servlet fork on our side and going back to the mainstream gRPC would be a plus. Thanks ! |
up vote fo this PR |
Friendly ping for merge. It seems like this is both approved and passing. |
Add option to force servlet transport to send trailers to avoid empty data frame with end_stream flag from servlet containers implementation (currently Tomcat).
fixes #10124