grpc-java icon indicating copy to clipboard operation
grpc-java copied to clipboard

NoSuchMethodError ManagedClientTransport$Listener.filterTransport

Open jwojciechowski-rtbh opened this issue 1 year ago • 1 comments

What version of gRPC-Java are you using?

1.62.2

What is your environment?

Linux, running in a Docker container based on image eclipse-temurin:21-jdk-jammy

What did you expect to see?

I just upgraded gRPC-Java from 1.61.1 to 1.62.2 and didn't do any other changes. I was expecting that the following code will work as previously and should succeed

blockingStub.withDeadlineAfter(DEADLINE_MS, TimeUnit.MILLISECONDS)
                .check(request);

instead, it throws an exception - see below.

What did you see instead?

I get the exception:

io.grpc.StatusRuntimeException: UNKNOWN
	at io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:268)
	at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:249)
	at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:167)
	at grpc.health.v1.HealthGrpc$HealthBlockingStub.check(HealthGrpc.java:160)
	... frames omitted
Caused by: java.lang.NoSuchMethodError: 'io.grpc.Attributes io.grpc.internal.ManagedClientTransport$Listener.filterTransport(io.grpc.Attributes)'
	at io.grpc.netty.shaded.io.grpc.netty.ClientTransportLifecycleManager.filterAttributes(ClientTransportLifecycleManager.java:44)
	at io.grpc.netty.shaded.io.grpc.netty.NettyClientHandler$FrameListener.onSettingsRead(NettyClientHandler.java:920)
	at io.grpc.netty.shaded.io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder$FrameReadListener.onSettingsRead(DefaultHttp2ConnectionDecoder.java:515)
	at io.grpc.netty.shaded.io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder$PrefaceFrameListener.onSettingsRead(DefaultHttp2ConnectionDecoder.java:735)
	at io.grpc.netty.shaded.io.netty.handler.codec.http2.Http2InboundFrameLogger$1.onSettingsRead(Http2InboundFrameLogger.java:93)
	at io.grpc.netty.shaded.io.netty.handler.codec.http2.DefaultHttp2FrameReader.readSettingsFrame(DefaultHttp2FrameReader.java:532)
	at io.grpc.netty.shaded.io.netty.handler.codec.http2.DefaultHttp2FrameReader.processPayloadState(DefaultHttp2FrameReader.java:262)
	at io.grpc.netty.shaded.io.netty.handler.codec.http2.DefaultHttp2FrameReader.readFrame(DefaultHttp2FrameReader.java:159)
	at io.grpc.netty.shaded.io.netty.handler.codec.http2.Http2InboundFrameLogger.readFrame(Http2InboundFrameLogger.java:41)
	at io.grpc.netty.shaded.io.netty.handler.codec.http2.DefaultHttp2ConnectionDecoder.decodeFrame(DefaultHttp2ConnectionDecoder.java:173)
	at io.grpc.netty.shaded.io.netty.handler.codec.http2.Http2ConnectionHandler$FrameDecoder.decode(Http2ConnectionHandler.java:393)
	at io.grpc.netty.shaded.io.netty.handler.codec.http2.Http2ConnectionHandler$PrefaceDecoder.decode(Http2ConnectionHandler.java:250)
	at io.grpc.netty.shaded.io.netty.handler.codec.http2.Http2ConnectionHandler.decode(Http2ConnectionHandler.java:453)
	at io.grpc.netty.shaded.io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:529)
	at io.grpc.netty.shaded.io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:468)
	at io.grpc.netty.shaded.io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:290)
	at io.grpc.netty.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
	at io.grpc.netty.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
	at io.grpc.netty.shaded.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
	at io.grpc.netty.shaded.io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
	at io.grpc.netty.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440)
	at io.grpc.netty.shaded.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
	at io.grpc.netty.shaded.io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
	at io.grpc.netty.shaded.io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:800)
	at io.grpc.netty.shaded.io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:509)
	at io.grpc.netty.shaded.io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:407)
	at io.grpc.netty.shaded.io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
	at io.grpc.netty.shaded.io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
	at io.grpc.netty.shaded.io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	... 1 common frames omitted

Steps to reproduce the bug

HealthGrpc.HealthBlockingStub blockingStub = HealthGrpc.newBlockingStub(managedChannel);

Healthcheck.HealthCheckRequest request = Healthcheck.HealthCheckRequest.newBuilder().setService("serviceName").build();

// the exception is thrown here
blockingStub.withDeadlineAfter(DEADLINE_MS, TimeUnit.MILLISECONDS).check(request);

jwojciechowski-rtbh avatar Mar 06 '24 20:03 jwojciechowski-rtbh

Are you using Maven? It looks like Maven is letting a package be downgraded. See the similar issue https://stackoverflow.com/a/70157477/4690866 for some tips to resolve. We highly recommend enabling requireUpperBoundDeps. Fixing the downgrade may be all that you need to do, but using a bom to keep grpc versions aligned is also helpful. That answer uses com.google.cloud:libraries-bom because they were using those libraries; you would use io.grpc:grpc-bom instead.

ejona86 avatar Mar 12 '24 14:03 ejona86

Seems like this should be resolved by my last comment. If not, comment, and it can be reopened.

ejona86 avatar Mar 20 '24 21:03 ejona86