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

NullPointerException in ReconnectTask and ConnectActionListener.onFailure, ClientComms.getNetworkModules() is null after close() #1036

Open
1 task done
in-fke opened this issue May 6, 2024 · 0 comments

Comments

@in-fke
Copy link

in-fke commented May 6, 2024

Please fill out the form below before submitting, thank you!

  • Bug exists Release Version 1.2.5 ( Master Branch)
  • [?] Bug exists in MQTTv3 Client on Snapshot Version 1.2.6-SNAPSHOT (Develop Branch)
  • [?] Bug exists in MQTTv5 Client on Snapshot Version 1.2.6-SNAPSHOT (Develop Branch)

Line with NPE is:
https://github.com/eclipse/paho.mqtt.java/blob/master/org.eclipse.paho.mqttv5.client/src/main/java/org/eclipse/paho/mqttv5/client/internal/ConnectActionListener.java#L195

Exception in thread "MQTT Reconnect: Application" java.lang.NullPointerException: Cannot read the array length because the return value of "org.eclipse.paho.mqttv5.client.internal.ClientComms.getNetworkModules()" is null
	at org.eclipse.paho.mqttv5.client.internal.ConnectActionListener.onFailure(ConnectActionListener.java:195)
	at org.eclipse.paho.mqttv5.client.internal.ConnectActionListener.connect(ConnectActionListener.java:248)
	at org.eclipse.paho.mqttv5.client.MqttAsyncClient.connect(MqttAsyncClient.java:783)
	at org.eclipse.paho.mqttv5.client.MqttAsyncClient.attemptReconnect(MqttAsyncClient.java:1583)
	at org.eclipse.paho.mqttv5.client.MqttAsyncClient.access$2(MqttAsyncClient.java:1578)
	at org.eclipse.paho.mqttv5.client.MqttAsyncClient$ReconnectTask.run(MqttAsyncClient.java:1623)
	at java.base/java.util.TimerThread.mainLoop(Timer.java:566)
	at java.base/java.util.TimerThread.run(Timer.java:516)

Maybe close() should invoke stopReconnectCycle()?
Alternatively, ReconnectTask should not invoke attemptReconnect() if client was closed?

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

1 participant