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

一直写java.lang.NullPointerException: null日志,每天产生60G日志 #221

Open
vinnyyou opened this issue Nov 23, 2023 · 6 comments · May be fixed by #235
Open

一直写java.lang.NullPointerException: null日志,每天产生60G日志 #221

vinnyyou opened this issue Nov 23, 2023 · 6 comments · May be fixed by #235

Comments

@vinnyyou
Copy link

一直在写如下日志,每天产生60G消息,请问这是什么问题
java.lang.NullPointerException: null
at org.apache.rocketmq.mqtt.common.util.TopicUtils.decode(TopicUtils.java:116)
at org.apache.rocketmq.mqtt.cs.session.match.MatchAction.matchClients(MatchAction.java:54)
at org.apache.rocketmq.mqtt.cs.session.notify.MessageNotifyAction.notify(MessageNotifyAction.java:60)
at org.apache.rocketmq.mqtt.cs.protocol.rpc.RpcPacketDispatcher.doNotify(RpcPacketDispatcher.java:75)
at org.apache.rocketmq.mqtt.cs.protocol.rpc.RpcPacketDispatcher.processRequest(RpcPacketDispatcher.java:56)
at org.apache.rocketmq.remoting.netty.NettyRemotingAbstract$1.run(NettyRemotingAbstract.java:229)
at org.apache.rocketmq.remoting.netty.RequestTask.run(RequestTask.java:80)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
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)

@DongyuanPan
Copy link
Contributor

哪个版本的?

@vinnyyou
Copy link
Author

版本号rocketmq-4.9.7, rocketket-mqtt 1.0.1

@leizhiyuan
Copy link

leizhiyuan commented Nov 24, 2023

可以debug,或者arthas看一下,这个消息体

image

这里的分支覆盖不全,看着确实如果没有mqtt的属性,就不会设置topic,就会导致为null

@ShiXulu
Copy link

ShiXulu commented Dec 12, 2023

消息无法消费,产生大量的retry消息,然后走到这儿又不被认为是mqtt消息(因为检查user property中没有PROPERTY_ORIGIN_MQTT_TOPIC属性)。

@ShiXulu
Copy link

ShiXulu commented Dec 12, 2023

消息无法消费,产生大量的retry消息,然后走到这儿又不被认为是mqtt消息(因为检查user property中没有PROPERTY_ORIGIN_MQTT_TOPIC属性)。

然后,也没有PROPERTY_INNER_MULTI_DISPATCH这个属性,最终event中的topic为空。
另一线程处理event,跑到matchClients这里,TopicUtils.decode(topic)里面未做空判断,直接NPE。

话说回来,消息为啥消费不了?跑的example里面的consumer,依然无法消费。
还有mqttx死活都连不上去,就算用example里面的签名方法处理之后,一样不行。

@DongyuanPan
Copy link
Contributor

消息无法消费,产生大量的retry消息,然后走到这儿又不被认为是mqtt消息(因为检查user property中没有PROPERTY_ORIGIN_MQTT_TOPIC属性)。

然后,也没有PROPERTY_INNER_MULTI_DISPATCH这个属性,最终event中的topic为空。 另一线程处理event,跑到matchClients这里,TopicUtils.decode(topic)里面未做空判断,直接NPE。

话说回来,消息为啥消费不了?跑的example里面的consumer,依然无法消费。 还有mqttx死活都连不上去,就算用example里面的签名方法处理之后,一样不行。

这个问题应该是RMQ没有开启LMQ这个特性导致的;用example里面的签名方法处理之后应该是需要Base64字符串才能使用在mqttx上。
image
只需要取前半部分的就可以了,不要输入toCharArray的。mqttx会对字符串再求一次

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

Successfully merging a pull request may close this issue.

4 participants