Repository navigation
Closed
pravega/pravega
#6393Milestone
Description
What version of gRPC-Java are you using?
1.36.0
What is your environment?
macOS, jdk11
What did you expect to see?
Server can process a request which contains content-length header.
What did you see instead?
A change in Netty 4.1.60 introduces usage of the Http2Headers#setLong(..) method, but grpc-java's custom header implementations do not implement this method (e.g. throw UnsupportedOperationException).
java.lang.UnsupportedOperationException
at io.grpc.netty.AbstractHttp2Headers.setLong(AbstractHttp2Headers.java:465)
at io.grpc.netty.AbstractHttp2Headers.setLong(AbstractHttp2Headers.java:26)
at io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder$FrameReadListener.onHeadersRead(DefaultHttp2ConnectionDecoder.java:403)
at io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder$FrameReadListener.onHeadersRead(DefaultHttp2ConnectionDecoder.java:347)
at io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder$PrefaceFrameListener.onHeadersRead(DefaultHttp2ConnectionDecoder.java:707)
at io.netty.handler.codec.http2.Http2InboundFrameLogger$1.onHeadersRead(Http2InboundFrameLogger.java:56)
at io.netty.handler.codec.http2.DefaultHttp2FrameReader$2.processFragment(DefaultHttp2FrameReader.java:483)
at io.netty.handler.codec.http2.DefaultHttp2FrameReader.readHeadersFrame(DefaultHttp2FrameReader.java:491)
at io.netty.handler.codec.http2.DefaultHttp2FrameReader.processPayloadState(DefaultHttp2FrameReader.java:254)
at io.netty.handler.codec.http2.DefaultHttp2FrameReader.readFrame(DefaultHttp2FrameReader.java:160)
at io.netty.handler.codec.http2.Http2InboundFrameLogger.readFrame(Http2InboundFrameLogger.java:41)
at io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder.decodeFrame(DefaultHttp2ConnectionDecoder.java:181)
at io.netty.handler.codec.http2.Http2ConnectionHandler$FrameDecoder.decode(Http2ConnectionHandler.java:378)
at io.netty.handler.codec.http2.Http2ConnectionHandler$PrefaceDecoder.decode(Http2ConnectionHandler.java:242)
at io.netty.handler.codec.http2.Http2ConnectionHandler.decode(Http2ConnectionHandler.java:438)
at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:508)
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:447)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:276)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:719)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:655)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:581)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:834)
Steps to reproduce the bug
- upgrade netty dependency to
4.1.60.Final - send a request with
content-lengthheader - server should fail to process the request with the exception above.
Activity
[-]Nett[/-][+]UnsupportedOperationException after Netty 4.1.60 update[/+]sanjaypujare commentedon Mar 10, 2021
@ejona86 we discussed this today and IIRC we have a plan to fix this ASAP, right?
@Scottmitch you have the workaround of not upgrading the netty dependency to
4.1.60.Finaland leave it to what grpc has (4.1.52.Final?)ejona86 commentedon Mar 10, 2021
Yeah, most users are using grpc-netty-shaded and so won't have this trouble. But we do want to help those using grpc-netty to allow them to upgrade Netty. We should implement the missing method and backport it to a 1.36.1 and 1.35.1.
Update Netty 4.1.59 -> 4.1.60
Update Netty 4.1.59 -> 4.1.60
Update Netty 4.1.59 -> 4.1.60 (#1419)
netty: Add Http2Headers.setLong() for inbound headers
netty: Add Http2Headers.setLong() for inbound headers
netty: Add Http2Headers.setLong() for inbound headers
netty: Add Http2Headers.setLong() for inbound headers
netty: Add Http2Headers.setLong() for inbound headers
netty: Add Http2Headers.setLong() for inbound headers
netty: Add Http2Headers.setLong() for inbound headers
netty: Add Http2Headers.setLong() for inbound headers
xenji commentedon Mar 22, 2021
There is a critical CVE for netty 4.1.52. Is there any plan to upgrade the shaded version?
ejona86 commentedon Mar 22, 2021
No, not for the CVEs as they do not impact gRPC. If you are using grpc-netty-shaded there is no issue.
Also, netty/netty-jni-util#5 prevents us from upgrading to recent releases. (But like I said before, we do want to be compatible with new releases for grpc-netty.)
njhill commentedon Mar 23, 2021
Sorry to bug but is there an ETA for 1.36.x release with this fix in?
ejona86 commentedon Mar 24, 2021
Fixed by #7967. v1.35.1 and v1.36.1 are now released that include this backport. v1.36.1 beat v1.35.1 by a few hours, so don't be surprised if you don't see v1.35.1 yet.
Update grpc-java 1.36.0 -> 1.36.1 (compatibility testing)
Update grpc-java 1.36.0 -> 1.36.1 (compatibility testing) (#1460)