wuhaoqiang1 opened a new issue, #10014:
URL: https://github.com/apache/dubbo/issues/10014

   <!-- If you need to report a security issue please visit 
https://github.com/apache/dubbo/security/policy -->
   
   - [ ] I have searched the [issues](https://github.com/apache/dubbo/issues) 
of this repository and believe that this is not a duplicate.
   
   ### Environment
   
   * Dubbo version: 3.0.7
   * Operating System version: window10
   * Java version: 1.8
   
   ### Steps to reproduce this issue
   
   1. dubbo版本3.0.7,dubbo-serialization-protobuf版本2.7.15
   2. 调用过程,调用链到GenericProtobufObjectOutput类的writeAttachments方法时报错
   io.netty.handler.codec.EncoderException: java.lang.ClassCastException: 
java.lang.Integer cannot be cast to java.lang.String
        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.lang.Thread.run(Thread.java:748)
   Caused by: java.lang.ClassCastException: java.lang.Integer cannot be cast to 
java.lang.String
        at 
org.apache.dubbo.common.serialize.protobuf.support.GenericProtobufObjectOutput.lambda$writeAttachments$0(GenericProtobufObjectOutput.java:146)
        at java.util.HashMap.forEach(HashMap.java:1289)
        at 
org.apache.dubbo.common.serialize.protobuf.support.GenericProtobufObjectOutput.writeAttachments(GenericProtobufObjectOutput.java:146)
        at 
org.apache.dubbo.rpc.protocol.dubbo.DubboCodec.encodeRequestData(DubboCodec.java:210)
        at 
org.apache.dubbo.remoting.exchange.codec.ExchangeCodec.encodeRequest(ExchangeCodec.java:257)
        at 
org.apache.dubbo.remoting.exchange.codec.ExchangeCodec.encode(ExchangeCodec.java:71)
        at 
org.apache.dubbo.rpc.protocol.dubbo.DubboCountCodec.encode(DubboCountCodec.java:47)
        at 
org.apache.dubbo.remoting.transport.netty4.NettyCodecAdapter$InternalEncoder.encode(NettyCodecAdapter.java:69)
        at 
io.netty.handler.codec.MessageToByteEncoder.write(MessageToByteEncoder.java:107)
   
   
   打断点查看,Map<String, Object> attachments的值如下
   
   
{"path":"com.example.api.grpc.GreeterService","remote.application":"myconsumer","interface":"com.example.api.grpc.GreeterService","version":"0.0.0","timeout":1000}
   
   比3.0.4版本多了timeout参数,并且是Integer类型,无法强转为String类型,导致报错
   
   
   测试dubbo3.0.4调用正常,无timeout参数
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to