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

NPE when use netty3 and kryo2 #7048

Open
2 tasks done
zhangyz-hd opened this issue Dec 22, 2020 · 2 comments
Open
2 tasks done

NPE when use netty3 and kryo2 #7048

zhangyz-hd opened this issue Dec 22, 2020 · 2 comments

Comments

@zhangyz-hd
Copy link
Contributor

  • I have searched the issues of this repository and believe that this is not a duplicate.
  • I have checked the FAQ 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
  1. A consumer with client=netty3
dubbo.consumer.client=netty3
  1. 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
@dkisser
Copy link

dkisser commented Dec 24, 2020

change serialization to "kryo", the "kryo2" not support event , it may have another purpose.The reason of the NPE is that the data of channel event is null .it's outputObject will use Kryo.writeObjectOrNull(Output output, Object object, Class type), when use "kryo2" . data is null ,so that data.getClass() will throw NPE.
kery2error

@zhangyz-hd
Copy link
Contributor Author

change serialization to "kryo", the "kryo2" not support event , it may have another purpose.The reason of the NPE is that the data of channel event is null .it's outputObject will use Kryo.writeObjectOrNull(Output output, Object object, Class type), when use "kryo2" . data is null ,so that data.getClass() will throw NPE.
kery2error

I know that kryo2 was not publid. But when I added a method to org.apache.dubbo.common.serialize.Serialization, kryo2 caused me some trouble, so I should delete kryo2 implements?

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

2 participants