Skip to content

Conversation

@panchenko
Copy link
Contributor

It eventually happens from Tomcat when it's behind nginx.
Currently caller gets just io.grpc.StatusRuntimeException: CANCELLED which is not very clear.

I guess when this code was originally developed, the assumption was that nobody will received it, but it actually happens, so worth making this status more clear.

if you are curious, the exception which causes that is

java.io.IOException: null
	at org.apache.coyote.http2.Stream$StandardStreamInputBuffer.receiveReset(Stream.java:1516)
	at org.apache.coyote.http2.Stream.receiveReset(Stream.java:227)
	at org.apache.coyote.http2.Http2UpgradeHandler.close(Http2UpgradeHandler.java:1302)
	at org.apache.coyote.http2.Http2UpgradeHandler.upgradeDispatch(Http2UpgradeHandler.java:434)
	at org.apache.coyote.http2.Http2AsyncUpgradeHandler.upgradeDispatch(Http2AsyncUpgradeHandler.java:43)
	at org.apache.coyote.http2.Http2AsyncParser$FrameCompletionHandler.failed(Http2AsyncParser.java:337)
	at org.apache.coyote.http2.Http2AsyncParser$FrameCompletionHandler.failed(Http2AsyncParser.java:167)
	at org.apache.tomcat.util.net.SocketWrapperBase$VectoredIOCompletionHandler.failed(SocketWrapperBase.java:1174)
	at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper$NioOperationState.run(NioEndpoint.java:1710)

@shivaspeaks shivaspeaks added the kokoro:run Add this label to a PR to tell Kokoro the code is safe and tests can be run label Mar 2, 2025
@grpc-kokoro grpc-kokoro removed the kokoro:run Add this label to a PR to tell Kokoro the code is safe and tests can be run label Mar 2, 2025
transportState.runOnTransportThread(() -> transportState.transportReportStatus(status));
// There is no way to RST_STREAM with CANCEL code, so write trailers instead
close(Status.CANCELLED.withCause(status.asRuntimeException()), new Metadata());
close(Status.CANCELLED.withDescription("servlet io exception")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The description doesn't seem right - we can't assume it was an IO exception, and there may be other causes on non-Tomcat containers. Can we just say "Stream cancelled"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is received by client - I want to be able to find the source of that in code, otherwise it's quite confusing.
As logic here is a bit special for servlets, I would keep the "servlet" word.
so, can we agree on "servlet stream cancelled" ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but lets capitalize the first letter. Other places setting description in status do so.

@shivaspeaks shivaspeaks added the kokoro:run Add this label to a PR to tell Kokoro the code is safe and tests can be run label Mar 12, 2025
@grpc-kokoro grpc-kokoro removed the kokoro:run Add this label to a PR to tell Kokoro the code is safe and tests can be run label Mar 12, 2025
@shivaspeaks shivaspeaks merged commit fca1d3c into grpc:master Mar 12, 2025
16 checks passed
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 11, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants