Visitar URL original
UnsupportedOperationException after Netty 4.1.60 update · Issue #7953 · grpc/grpc-java · GitHub
Skip to content

UnsupportedOperationException after Netty 4.1.60 update #7953

Closed
pravega/pravega
#6393

Description

@Scottmitch

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

  1. upgrade netty dependency to 4.1.60.Final
  2. send a request with content-length header
  3. server should fail to process the request with the exception above.

Activity

  1. changed the title [-]Nett[/-] [+]UnsupportedOperationException after Netty 4.1.60 update[/+] on Mar 9, 2021
  2. sanjaypujare commented on Mar 10, 2021

    @sanjaypujare
    Contributor

    @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.Final and leave it to what grpc has (4.1.52.Final ?)

  3. ejona86 commented on Mar 10, 2021

    @ejona86
    Member

    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.

  4. self-assigned this
    on Mar 12, 2021
  5. added this to the 1.37 milestone on Mar 12, 2021
  6. xenji commented on Mar 22, 2021

    @xenji

    There is a critical CVE for netty 4.1.52. Is there any plan to upgrade the shaded version?

    grpc-netty-shaded-1.36.0.jar/META-INF/maven/io.netty/netty-buffer/pom.xml (pkg:maven/io.netty/netty-buffer@4.1.52.Final, cpe:2.3:a:netty:netty:4.1.52:*:*:*:*:*:*:*) : CVE-2021-21290
    grpc-netty-shaded-1.36.0.jar/META-INF/maven/io.netty/netty-codec-http/pom.xml (pkg:maven/io.netty/netty-codec-http@4.1.52.Final, cpe:2.3:a:netty:netty:4.1.52:*:*:*:*:*:*:*) : CVE-2021-21290
    grpc-netty-shaded-1.36.0.jar/META-INF/maven/io.netty/netty-codec-http2/pom.xml (pkg:maven/io.netty/netty-codec-http2@4.1.52.Final, cpe:2.3:a:netty:netty:4.1.52:*:*:*:*:*:*:*) : CVE-2021-21290
    grpc-netty-shaded-1.36.0.jar/META-INF/maven/io.netty/netty-codec-socks/pom.xml (pkg:maven/io.netty/netty-codec-socks@4.1.52.Final, cpe:2.3:a:netty:netty:4.1.52:*:*:*:*:*:*:*) : CVE-2021-21290
    grpc-netty-shaded-1.36.0.jar/META-INF/maven/io.netty/netty-codec/pom.xml (pkg:maven/io.netty/netty-codec@4.1.52.Final, cpe:2.3:a:netty:netty:4.1.52:*:*:*:*:*:*:*) : CVE-2021-21290
    grpc-netty-shaded-1.36.0.jar/META-INF/maven/io.netty/netty-common/pom.xml (pkg:maven/io.netty/netty-common@4.1.52.Final, cpe:2.3:a:netty:netty:4.1.52:*:*:*:*:*:*:*) : CVE-2021-21290
    grpc-netty-shaded-1.36.0.jar/META-INF/maven/io.netty/netty-handler-proxy/pom.xml (pkg:maven/io.netty/netty-handler-proxy@4.1.52.Final, cpe:2.3:a:netty:netty:4.1.52:*:*:*:*:*:*:*) : CVE-2021-21290
    grpc-netty-shaded-1.36.0.jar/META-INF/maven/io.netty/netty-handler/pom.xml (pkg:maven/io.netty/netty-handler@4.1.52.Final, cpe:2.3:a:netty:netty:4.1.52:*:*:*:*:*:*:*) : CVE-2021-21290
    grpc-netty-shaded-1.36.0.jar/META-INF/maven/io.netty/netty-resolver/pom.xml (pkg:maven/io.netty/netty-resolver@4.1.52.Final, cpe:2.3:a:netty:netty:4.1.52:*:*:*:*:*:*:*) : CVE-2021-21290
    grpc-netty-shaded-1.36.0.jar/META-INF/maven/io.netty/netty-transport-native-epoll/pom.xml (pkg:maven/io.netty/netty-transport-native-epoll@4.1.52.Final, cpe:2.3:a:netty:netty:4.1.52:*:*:*:*:*:*:*) : CVE-2021-21290
    grpc-netty-shaded-1.36.0.jar/META-INF/maven/io.netty/netty-transport-native-unix-common/pom.xml (pkg:maven/io.netty/netty-transport-native-unix-common@4.1.52.Final, cpe:2.3:a:netty:netty:4.1.52:*:*:*:*:*:*:*) : CVE-2021-21290
    grpc-netty-shaded-1.36.0.jar/META-INF/maven/io.netty/netty-transport/pom.xml (pkg:maven/io.netty/netty-transport@4.1.52.Final, cpe:2.3:a:netty:netty:4.1.52:*:*:*:*:*:*:*) : CVE-2021-21290
    
  7. ejona86 commented on Mar 22, 2021

    @ejona86
    Member

    Is there any plan to upgrade the shaded version?

    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.)

  8. njhill commented on Mar 23, 2021

    @njhill
    Contributor

    Sorry to bug but is there an ETA for 1.36.x release with this fix in?

  9. ejona86 commented on Mar 24, 2021

    @ejona86
    Member

    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.

  10. locked as resolved and limited conversation to collaborators on Jun 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions