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

Automatically reconnect if MQTT connection is lost #4

Open
climategadgets opened this issue Dec 15, 2020 · 2 comments
Open

Automatically reconnect if MQTT connection is lost #4

climategadgets opened this issue Dec 15, 2020 · 2 comments
Labels
bug Something isn't working fault tolerance usability

Comments

@climategadgets
Copy link
Member

Expected result

MQTT connection stays on as long as the broker is up

Actual result

MQTT connection drops once in a while

@climategadgets
Copy link
Member Author

Closing for now, will reopen if the lazy fix is too lazy

@climategadgets
Copy link
Member Author

As of 50fb3df: reconnection is not persistent enough, fails for long timeouts. Need to be more aggressive; reopening.

11:59:10,746 ERROR MqttReader MQTT Rec: 779a6544-6f69-4786-9070-2b8f61a844eb [] Lost connection
 org.eclipse.paho.client.mqttv3.MqttException: Connection lost
        at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:190) [org.eclipse.paho.client.mqttv3-1.2.2.jar:?]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_252]
Caused by: java.io.EOFException
        at java.io.DataInputStream.readByte(DataInputStream.java:267) ~[?:1.8.0_252]
        at org.eclipse.paho.client.mqttv3.internal.wire.MqttInputStream.readMqttWireMessage(MqttInputStream.java:92) ~[org.eclipse.paho.client.mqttv3-1.2.2.jar:?]
        at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:137) ~[org.eclipse.paho.client.mqttv3-1.2.2.jar:?]
        ... 1 more
11:59:10,753 INFO MqttReader MQTT Rec: 779a6544-6f69-4786-9070-2b8f61a844eb [] Attempting to reconnect
11:59:16,066 FATAL MqttReader MQTT Rec: 779a6544-6f69-4786-9070-2b8f61a844eb [] Reconnect failed, giving up
 org.eclipse.paho.client.mqttv3.MqttException: Unable to connect to server
        at org.eclipse.paho.client.mqttv3.internal.TCPNetworkModule.start(TCPNetworkModule.java:80) ~[org.eclipse.paho.client.mqttv3-1.2.2.jar:?]
        at org.eclipse.paho.client.mqttv3.internal.ClientComms$ConnectBG.run(ClientComms.java:722) ~[org.eclipse.paho.client.mqttv3-1.2.2.jar:?]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_252]
Caused by: java.net.ConnectException: Connection refused (Connection refused)
        at java.net.PlainSocketImpl.socketConnect(Native Method) ~[?:1.8.0_252]
        at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[?:1.8.0_252]
        at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[?:1.8.0_252]
        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[?:1.8.0_252]
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[?:1.8.0_252]
        at java.net.Socket.connect(Socket.java:607) ~[?:1.8.0_252]
        at org.eclipse.paho.client.mqttv3.internal.TCPNetworkModule.start(TCPNetworkModule.java:74) ~[org.eclipse.paho.client.mqttv3-1.2.2.jar:?]
        ... 2 more

@climategadgets climategadgets reopened this Feb 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fault tolerance usability
Projects
None yet
Development

No branches or pull requests

1 participant