Skip to content
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

Implement Http2Headers.isEmpty (1.59.x backport) #10689

Merged
merged 1 commit into from
Nov 20, 2023

Conversation

ejona86
Copy link
Member

@ejona86 ejona86 commented Nov 20, 2023

Fixes #10665

Using grpc-netty with Netty 4.1.101.Final results in the following error:

io.grpc.StatusRuntimeException: UNKNOWN
	at app//io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:275)
	at app//io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:256)
	at app//io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:169)
	// Remaining stacktrace omitted
Caused by: java.lang.UnsupportedOperationException
	at io.grpc.netty.AbstractHttp2Headers.isEmpty(AbstractHttp2Headers.java:40)
	at io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder$FrameReadListener.onHeadersRead(DefaultHttp2ConnectionDecoder.java:419)
	at io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder$FrameReadListener.onHeadersRead(DefaultHttp2ConnectionDecoder.java:352)
	at io.netty.handler.codec.http2.Http2InboundFrameLogger$1.onHeadersRead(Http2InboundFrameLogger.java:56)
	at io.netty.handler.codec.http2.DefaultHttp2FrameReader$2.processFragment(DefaultHttp2FrameReader.java:476)
	at io.netty.handler.codec.http2.DefaultHttp2FrameReader.readHeadersFrame(DefaultHttp2FrameReader.java:484)
	at io.netty.handler.codec.http2.DefaultHttp2FrameReader.processPayloadState(DefaultHttp2FrameReader.java:253)
	at io.netty.handler.codec.http2.DefaultHttp2FrameReader.readFrame(DefaultHttp2FrameReader.java:159)
	at io.netty.handler.codec.http2.Http2InboundFrameLogger.readFrame(Http2InboundFrameLogger.java:41)
	at io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder.decodeFrame(DefaultHttp2ConnectionDecoder.java:188)
	at io.netty.handler.codec.http2.Http2ConnectionHandler$FrameDecoder.decode(Http2ConnectionHandler.java:393)
	at io.netty.handler.codec.http2.Http2ConnectionHandler.decode(Http2ConnectionHandler.java:453)
	// Remaining stacktrace omitted

In netty/netty@2657079, Netty introduced code that calls Http2Headers.isEmpty. However the gRPC Http2Headers implementations do not implement this method. I assume this is simply an oversight.

AbstractHttp2Headers feels a fairly brittle. There are a number of methods here that are not implemented by the concrete implementations. Future Netty versions could begin calling these methods and cause similar failures. I wonder if it might be better to eliminate AbstractHttp2Headers to ensure that any unsupported methods are unsupported intentionally rather that accidentally. It seems like this isn't the first time there have been issues like this, see #7953.

Backport of #10663

@ejona86 ejona86 merged commit 85d3611 into grpc:v1.59.x Nov 20, 2023
5 of 6 checks passed
@ejona86 ejona86 deleted the backport-isEmpty-1.59 branch November 20, 2023 21:54
@SkyeBeFreeman
Copy link

When will this bugfix version be released?

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 26, 2024
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