Skip to content

Issue with connection lost #2

@simo101

Description

@simo101

Hi Andrej,

I think there is currently an issue with the MQTT client. In my example if the connection is lost for a bit then the application fails to connect and doesn't continue to query the MQTT.

I believe the issue is here:

https://github.com/ako/MqttClient/blob/master/javasource/mqttclient/impl/MxMqttCallback.java#L27

I think this is because it is missing the connections options in the client.connect().

What it looks like you are trying to do is if the connection is lost it will try to connect again. But I think the connector then fails to connection. See error log:

Sep 3 17:49:59.023 127.0.0.1 tr10000: INFO - MqttHandler: connectionLost: Connection lost, MxClient_a3a331ac-b51e-4314-ba2a-c0d55b2c8ea1_appnode-leech_82.34.251.190_1883 Sep 3 17:49:59.026 127.0.0.1 tr10000: WARNING - MqttHandler: (1/9) org.eclipse.paho.client.mqttv3.MqttException: Connection lost Sep 3 17:49:59.026 127.0.0.1 tr10000: WARNING - MqttHandler: (2/9) at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:146) Sep 3 17:49:59.026 127.0.0.1 tr10000: WARNING - MqttHandler: (3/9) at java.lang.Thread.run(Thread.java:745) Sep 3 17:49:59.026 127.0.0.1 tr10000: WARNING - MqttHandler: (4/9) Sep 3 17:49:59.026 127.0.0.1 tr10000: WARNING - MqttHandler: (5/9) Caused by: java.io.EOFException: null Sep 3 17:49:59.026 127.0.0.1 tr10000: WARNING - MqttHandler: (6/9) at java.io.DataInputStream.readByte(DataInputStream.java:267) Sep 3 17:49:59.026 127.0.0.1 tr10000: WARNING - MqttHandler: (7/9) at org.eclipse.paho.client.mqttv3.internal.wire.MqttInputStream.readMqttWireMessage(MqttInputStream.java:65) Sep 3 17:49:59.026 127.0.0.1 tr10000: WARNING - MqttHandler: (8/9) at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:107) Sep 3 17:49:59.026 127.0.0.1 tr10000: WARNING - MqttHandler: (9/9) at java.lang.Thread.run(Thread.java:745) Sep 3 17:49:59.223 127.0.0.1 tr10000: ERROR - MqttHandler: (1/5) org.eclipse.paho.client.mqttv3.MqttSecurityException: Not authorized to connect Sep 3 17:49:59.223 127.0.0.1 tr10000: ERROR - MqttHandler: (2/5) at org.eclipse.paho.client.mqttv3.internal.ExceptionHelper.createMqttException(ExceptionHelper.java:28) Sep 3 17:49:59.223 127.0.0.1 tr10000: ERROR - MqttHandler: (3/5) at org.eclipse.paho.client.mqttv3.internal.ClientState.notifyReceivedAck(ClientState.java:885) Sep 3 17:49:59.223 127.0.0.1 tr10000: ERROR - MqttHandler: (4/5) at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:118) Sep 3 17:49:59.223 127.0.0.1 tr10000: ERROR - MqttHandler: (5/5) at java.lang.Thread.run(Thread.java:745)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions