Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ignore serialization ID for heartbeat message #1967

Closed
AlexStocks opened this issue Jun 20, 2018 · 5 comments
Closed

ignore serialization ID for heartbeat message #1967

AlexStocks opened this issue Jun 20, 2018 · 5 comments
Assignees
Milestone

Comments

@AlexStocks
Copy link
Contributor

AlexStocks commented Jun 20, 2018

我构造了一个二进制心跳包对服务端进行测试。在代码中我循环增大serialID从0开始直到其最大值31。其中 serialID 取值 [1, 3, 4, 5, 6, 7] 时,服务端有以下异常日志:

2018-06-14 14:50:04,598 [New I/O server worker #1-1] WARN  alibaba.dubbo.rpc.protocol.dubbo.DubboCodec (DubboCodec.java:140) -  [DUBBO] Decode request failed: Flag error, expect OBJECT_NULL|OBJECT_DUMMY|OBJECT_DESC|OBJECT_DESC_ID, get 78, dubbo version: 2.5.4, current host: 127.0.0.1
java.io.IOException: Flag error, expect OBJECT_NULL|OBJECT_DUMMY|OBJECT_DESC|OBJECT_DESC_ID, get 78
  at com.alibaba.dubbo.common.serialize.support.dubbo.GenericObjectInput.readObject(GenericObjectInput.java:79)
  at com.alibaba.dubbo.remoting.exchange.codec.ExchangeCodec.decodeHeartbeatData(ExchangeCodec.java:381)
  at com.alibaba.dubbo.rpc.protocol.dubbo.DubboCodec.decodeBody(DubboCodec.java:121)
  at com.alibaba.dubbo.remoting.exchange.codec.ExchangeCodec.decode(ExchangeCodec.java:118)
  at com.alibaba.dubbo.remoting.exchange.codec.ExchangeCodec.decode(ExchangeCodec.java:79)
  at com.alibaba.dubbo.rpc.protocol.dubbo.DubboCountCodec.decode(DubboCountCodec.java:46)
  at com.alibaba.dubbo.remoting.transport.netty.NettyCodecAdapter$InternalDecoder.messageReceived(NettyCodecAdapter.java:134)
  at org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:80)
  at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
  at org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559)
  at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:274)
  at org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:261)
  at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:349)
  at org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:280)
  at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:200)
  at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
  at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:44)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
  at java.lang.Thread.run(Thread.java:748)
2018-06-14 14:50:05,599 [New I/O server worker #1-1] WARN  com.alibaba.dubbo.remoting.transport.AbstractServer (AbstractServer.java:199) -  [DUBBO] All clients has discontected from /127.0.0.1:20000. You can graceful shutdown now., dubbo version: 2.5.4, current host: 127.0.0.1

经过与 相关同行 们讨论,说是这几个 ID 是内部保留的实例ID,如 https://github.com/apache/incubator-dubbo/blob/2.5.x/dubbo-common/src/main/java/com/alibaba/dubbo/common/serialize/support/json/FastJsonSerialization.java

针对这个例子,这个解释是 okay 的,可以解释这个错误。不过个人建议:服务端收到心跳包的时候不要检查 header 里面的 serialID,直接放过,可否?

因为心跳包不设计逻辑处理,不需要获取serialID对应的实例,这里检查这个字段有什么意义呢?因为这个原因就导致服务端抛出异常,个人觉得这个处理欠妥。

@ralf0131
Copy link
Contributor

I just did some twist to the style.

@chickenlj
Copy link
Contributor

I don't know why you want to try different serialID, which you mentioned from 0-31.

因为心跳包不设计逻辑处理,不需要获取serialID对应的实例,这里检查这个字段有什么意义呢?因为这个原因就导致服务端抛出异常,个人觉得这个处理欠妥。

But this part you mentioned is quite reasonable, if a heartbeat event doesn't have any payload, we don't have to deserialize anymore.

@chickenlj
Copy link
Contributor

Be aware that Dubbo itself mixed read-only and heartbeat event handling internally.

@diecui1202
Copy link

Any suggestion for this issue ?

@diecui1202 diecui1202 modified the milestones: 2.6.4, 2.6.5 Sep 14, 2018
@zonghaishang
Copy link
Member

心跳包不是没有body,只不过对应java的body是null, 但是null在不同序列化值不一样

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants