Closed childe-dragon closed 3 years ago
经过测试发现序列化换成hessian2正常 目前用的dubbo-serialization-kryo 2.7.9版本就会偶发性异常,想换高一点的版本但是貌似与3.0.3无法集成,会报如下错误 java.lang.NoSuchMethodError: org.apache.dubbo.common.utils.ReflectUtils.isJdk
Caused by: org.apache.dubbo.remoting.RemotingException: io.netty.handler.codec.EncoderException: java.lang.NoSuchMethodError: org.apache.dubbo.common.utils.ReflectUtils.isJdk(Ljava/lang/Class;)Z
io.netty.handler.codec.EncoderException: java.lang.NoSuchMethodError: org.apache.dubbo.common.utils.ReflectUtils.isJdk(Ljava/lang/Class;)Z
at io.netty.handler.codec.MessageToByteEncoder.write(MessageToByteEncoder.java:125)
at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:717)
at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:709)
at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:792)
at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:702)
at io.netty.handler.timeout.IdleStateHandler.write(IdleStateHandler.java:304)
at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:717)
at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:709)
at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:792)
at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:702)
at io.netty.channel.ChannelDuplexHandler.write(ChannelDuplexHandler.java:115)
at org.apache.dubbo.remoting.transport.netty4.NettyClientHandler.write(NettyClientHandler.java:88)
at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:717)
at io.netty.channel.AbstractChannelHandlerContext.invokeWriteAndFlush(AbstractChannelHandlerContext.java:764)
at io.netty.channel.AbstractChannelHandlerContext$WriteTask.run(AbstractChannelHandlerContext.java:1071)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute$$$capture(AbstractEventExecutor.java:164)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500)
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)
Caused by: java.lang.NoSuchMethodError: org.apache.dubbo.common.utils.ReflectUtils.isJdk(Ljava/lang/Class;)Z
at org.apache.dubbo.common.serialize.kryo.CompatibleKryo.getDefaultSerializer(CompatibleKryo.java:46)
at com.esotericsoftware.kryo.Kryo.register(Kryo.java:410)
at org.apache.dubbo.common.serialize.kryo.utils.AbstractKryoFactory.create(AbstractKryoFactory.java:112)
at org.apache.dubbo.common.serialize.kryo.utils.ThreadLocalKryoFactory$1.initialValue(ThreadLocalKryoFactory.java:26)
at org.apache.dubbo.common.serialize.kryo.utils.ThreadLocalKryoFactory$1.initialValue(ThreadLocalKryoFactory.java:23)
at java.base/java.lang.ThreadLocal.setInitialValue(ThreadLocal.java:195)
at java.base/java.lang.ThreadLocal.get(ThreadLocal.java:172)
at org.apache.dubbo.common.serialize.kryo.utils.ThreadLocalKryoFactory.getKryo(ThreadLocalKryoFactory.java:37)
at org.apache.dubbo.common.serialize.kryo.utils.KryoUtils.get(KryoUtils.java:30)
at org.apache.dubbo.common.serialize.kryo.KryoObjectOutput.
at org.apache.dubbo.remoting.exchange.support.DefaultFuture.doReceived(DefaultFuture.java:207)
at org.apache.dubbo.remoting.exchange.support.DefaultFuture.received(DefaultFuture.java:170)
at org.apache.dubbo.remoting.exchange.support.DefaultFuture.received(DefaultFuture.java:158)
at org.apache.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleResponse(HeaderExchangeHandler.java:60)
at org.apache.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:181)
at org.apache.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:51)
at org.apache.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:57)
at org.apache.dubbo.common.threadpool.ThreadlessExecutor$RunnableWrapper.run(ThreadlessExecutor.java:196)
at org.apache.dubbo.common.threadpool.ThreadlessExecutor.waitAndDrain(ThreadlessExecutor.java:99)
at org.apache.dubbo.rpc.AsyncRpcResult.get(AsyncRpcResult.java:179)
... 33 more
与dubbo其他分支对比了下, 3.0版本确实有isJdk方法,可能后续被移除了
Caused by: org.apache.dubbo.remoting.RemotingException: io.netty.handler.codec.EncoderException: java.lang.NoSuchMethodError: org.apache.dubbo.common.utils.ReflectUtils.isJdk(Ljava/lang/Class;)Z io.netty.handler.codec.EncoderException: java.lang.NoSuchMethodError: org.apache.dubbo.common.utils.ReflectUtils.isJdk(Ljava/lang/Class;)Z at io.netty.handler.codec.MessageToByteEncoder.write(MessageToByteEncoder.java:125) at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:717) at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:709) at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:792) at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:702) at io.netty.handler.timeout.IdleStateHandler.write(IdleStateHandler.java:304) at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:717) at io.netty.channel.AbstractChannelHandlerContext.invokeWrite(AbstractChannelHandlerContext.java:709) at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:792) at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:702) at io.netty.channel.ChannelDuplexHandler.write(ChannelDuplexHandler.java:115) at org.apache.dubbo.remoting.transport.netty4.NettyClientHandler.write(NettyClientHandler.java:88) at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:717) at io.netty.channel.AbstractChannelHandlerContext.invokeWriteAndFlush(AbstractChannelHandlerContext.java:764) at io.netty.channel.AbstractChannelHandlerContext$WriteTask.run(AbstractChannelHandlerContext.java:1071) at io.netty.util.concurrent.AbstractEventExecutor.safeExecute$$$capture(AbstractEventExecutor.java:164) at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java) at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500) 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) Caused by: java.lang.NoSuchMethodError: org.apache.dubbo.common.utils.ReflectUtils.isJdk(Ljava/lang/Class;)Z at org.apache.dubbo.common.serialize.kryo.CompatibleKryo.getDefaultSerializer(CompatibleKryo.java:46) at com.esotericsoftware.kryo.Kryo.register(Kryo.java:410) at org.apache.dubbo.common.serialize.kryo.utils.AbstractKryoFactory.create(AbstractKryoFactory.java:112) at org.apache.dubbo.common.serialize.kryo.utils.ThreadLocalKryoFactory$1.initialValue(ThreadLocalKryoFactory.java:26) at org.apache.dubbo.common.serialize.kryo.utils.ThreadLocalKryoFactory$1.initialValue(ThreadLocalKryoFactory.java:23) at java.base/java.lang.ThreadLocal.setInitialValue(ThreadLocal.java:195) at java.base/java.lang.ThreadLocal.get(ThreadLocal.java:172) at org.apache.dubbo.common.serialize.kryo.utils.ThreadLocalKryoFactory.getKryo(ThreadLocalKryoFactory.java:37) at org.apache.dubbo.common.serialize.kryo.utils.KryoUtils.get(KryoUtils.java:30) at org.apache.dubbo.common.serialize.kryo.KryoObjectOutput.(KryoObjectOutput.java:39) at org.apache.dubbo.common.serialize.kryo.KryoSerialization.serialize(KryoSerialization.java:51) at org.apache.dubbo.remoting.exchange.codec.ExchangeCodec.encodeRequest(ExchangeCodec.java:255) at org.apache.dubbo.remoting.exchange.codec.ExchangeCodec.encode(ExchangeCodec.java:71) at org.apache.dubbo.rpc.protocol.dubbo.DubboCountCodec.encode(DubboCountCodec.java:40) at org.apache.dubbo.remoting.transport.netty4.NettyCodecAdapter$InternalEncoder.encode(NettyCodecAdapter.java:69) at io.netty.handler.codec.MessageToByteEncoder.write(MessageToByteEncoder.java:107) ... 22 more
at org.apache.dubbo.remoting.exchange.support.DefaultFuture.doReceived(DefaultFuture.java:207) at org.apache.dubbo.remoting.exchange.support.DefaultFuture.received(DefaultFuture.java:170) at org.apache.dubbo.remoting.exchange.support.DefaultFuture.received(DefaultFuture.java:158) at org.apache.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.handleResponse(HeaderExchangeHandler.java:60) at org.apache.dubbo.remoting.exchange.support.header.HeaderExchangeHandler.received(HeaderExchangeHandler.java:181) at org.apache.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:51) at org.apache.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:57) at org.apache.dubbo.common.threadpool.ThreadlessExecutor$RunnableWrapper.run(ThreadlessExecutor.java:196) at org.apache.dubbo.common.threadpool.ThreadlessExecutor.waitAndDrain(ThreadlessExecutor.java:99) at org.apache.dubbo.rpc.AsyncRpcResult.get(AsyncRpcResult.java:179) ... 33 more
与dubbo其他分支对比了下, 3.0版本确实有isJdk方法,可能后续被移除了
可以查看这个PR,已经恢复isJdk方法,还没发布 #8968
以下情况会有一定几率出现,不知道是不是我使用不对
Environment
Steps to reproduce this issue
Pls. provide [GitHub address] to reproduce this issue.
Expected Result
What do you expected from the above steps?
Actual Result
What actually happens?
If there is an exception, please attach the exception trace: org.apache.dubbo.rpc.RpcException: Failed to invoke the method saveRecordBatchForSelect in the service com.ccxd.idp.ods.service.api.CcxdOdsDataSourceServiceApi. Tried 3 times of the providers [172.30.76.92:20880, 172.30.76.94:20880, 172.30.190.144:20880] (3/4) from the registry nacos-headless:8848 on the consumer 172.30.190.145 using the dubbo version 3.0.3. Last error is: Failed to invoke remote method: saveRecordBatchForSelect, provider: dubbo://172.30.76.92:20880/com.ccxd.idp.ods.service.api.CcxdOdsDataSourceServiceApi?application=idp-ods-service&category=providers&deprecated=false&dubbo=2.0.2&loadbalance=roundrobin&path=com.ccxd.idp.ods.service.api.CcxdOdsDataSourceServiceApi&protocol=dubbo&release=3.0.3&serialization=kryo&version=1.0.0, cause: org.apache.dubbo.remoting.RemotingException: Fail to decode request due to: java.lang.ClassCastException: class java.lang.String cannot be cast to class java.util.Map (java.lang.String and java.util.Map are in module java.base of loader 'bootstrap') java.lang.ClassCastException: class java.lang.String cannot be cast to class java.util.Map (java.lang.String and java.util.Map are in module java.base of loader 'bootstrap') at org.apache.dubbo.common.serialize.ObjectInput.readAttachments(ObjectInput.java:87) at org.apache.dubbo.rpc.protocol.dubbo.DecodeableRpcInvocation.decode(DecodeableRpcInvocation.java:224) at org.apache.dubbo.rpc.protocol.dubbo.DecodeableRpcInvocation.decode(DecodeableRpcInvocation.java:93) at org.apache.dubbo.remoting.transport.DecodeHandler.decode(DecodeHandler.java:57) at org.apache.dubbo.remoting.transport.DecodeHandler.received(DecodeHandler.java:44) at org.apache.dubbo.remoting.transport.dispatcher.ChannelEventRunnable.run(ChannelEventRunnable.java:57) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at org.apache.dubbo.common.threadlocal.InternalRunnable.run(InternalRunnable.java:41) at java.base/java.lang.Thread.run(Thread.java:834)