NPE when use netty3 and kryo2
- Dominant language
- Java
- Stars
- 41.6k
- Forks
- 26.4k
- Avg merge
- 15h 13m
- Merged PRs (30d)
- 4
Description
- [x] I have searched the [issues](https://github.com/apache/dubbo/issues) of this repository and believe that this is not a duplicate.
- [x] I have checked the [FAQ](https://github.com/apache/dubbo/blob/master/FAQ.md) of this repository and believe that this is not a duplicate.
### Environment
* Dubbo version: 2.7.8
* Operating System version: ANY
* Java version: OpenJDK 8
### Steps to reproduce this issue
1. A provider with server=netty3 and serialization=kryo2
```
dubbo.protocol.server=netty3
dubbo.protocol.serialization=kryo2
dubbo.protocol.heartbeat=5000
```
2. A consumer with client=netty3
```
dubbo.consumer.client=netty3
```
3. An NPE occurred when a heartbeat invoker between the provider and the consumer. Because heartbeat Request/Response data is always null.
Pls. provide [GitHub address] to reproduce this issue.
https://github.com/zhangyz-hd/dubbo-issues
If there is an exception, please attach the exception trace:
```
org.apache.dubbo.remoting.RemotingException: Failed to send message Request [id=6, version=2.0.2, twoway=true, event=true, broken=false, data=null] to /192.168.1.122:20881, cause: null
at org.apache.dubbo.remoting.transport.netty.NettyChannel.send(NettyChannel.java:113)
at org.apache.dubbo.remoting.transport.AbstractClient.send(AbstractClient.java:178)
at org.apache.dubbo.remoting.exchange.support.header.HeaderExchangeChannel.send(HeaderExchangeChannel.java:98)
at org.apache.dubbo.remoting.exchange.support.header.HeaderExchangeChannel.send(HeaderExchangeChannel.java:87)
at org.apache.dubbo.remoting.exchange.support.header.HeaderExchangeClient.send(HeaderExchangeClient.java:120)
at org.apache.dubbo.remoting.exchange.support.header.HeartbeatTimerTask.doTask(HeartbeatTimerTask.java:53)
at org.apache.dubbo.remoting.exchange.support.header.AbstractTimerTask.run(AbstractTimerTask.java:87)
at org.apache.dubbo.common.timer.HashedWheelTimer$HashedWheelTimeout.expire(HashedWheelTimer.java:648)
at org.apache.dubbo.common.timer.HashedWheelTimer$HashedWheelBucket.expireTimeouts(HashedWheelTimer.java:727)
at org.apache.dubbo.common.timer.HashedWheelTimer$Worker.run(HashedWheelTimer.java:449)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NullPointerException
at org.apache.dubbo.common.serialize.kryo.optimized.KryoObjectOutput2.writeObject(KryoObjectOutput2.java:104)
at org.apache.dubbo.common.serialize.ObjectOutput.writeEvent(ObjectOutput.java:53)
at org.apache.dubbo.remoting.exchange.codec.ExchangeCodec.encodeEventData(ExchangeCodec.java:377)
at org.apache.dubbo.remoting.exchange.codec.ExchangeCodec.encodeEventData(ExchangeCodec.java:429)
at org.apache.dubbo.remoting.exchange.codec.ExchangeCodec.encodeRequest(ExchangeCodec.java:236)
at org.apache.dubbo.remoting.exchange.codec.ExchangeCodec.encode(ExchangeCodec.java:69)
at org.apache.dubbo.rpc.protocol.dubbo.DubboCountCodec.encode(DubboCountCodec.java:40)
at org.apache.dubbo.remoting.transport.netty.NettyCodecAdapter$InternalEncoder.encode(NettyCodecAdapter.java:84)
at org.jboss.netty.handler.codec.oneone.OneToOneEncoder.handleDownstream(OneToOneEncoder.java:66)
at org.apache.dubbo.remoting.transport.netty.NettyHandler.writeRequested(NettyHandler.java:110)
at org.jboss.netty.channel.Channels.write(Channels.java:611)
at org.jboss.netty.channel.Channels.write(Channels.java:578)
at org.jboss.netty.channel.AbstractChannel.write(AbstractChannel.java:251)
at org.apache.dubbo.remoting.transport.netty.NettyChannel.send(NettyChannel.java:103)
... 10 more
```
Contributor guide
Research direction
Start at org.apache.dubbo.common.serialize.kryo.optimized.KryoObjectOutput2.writeObject, then trace the heartbeat path through ObjectOutput.writeEvent and ExchangeCodec.encodeEventData. Reproduce with the provider's netty3 and kryo2 settings and the consumer's netty3 setting. Done means heartbeat requests no longer fail with a NullPointerException.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- distributed-systems, networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100