Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [paho-dev] MQTT Connection Lost Error

Hi,

I am getting the following EOFException in the server log ---

00:00:12,054 ERROR [stderr] Connection lost (32109) - java.io.EOFException
00:00:12,054 ERROR [stderr] (MQTT Rec: ATTDriver1)      at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:138)
00:00:12,054 ERROR [stderr] at java.lang.Thread.run(Thread.java:724)
00:00:12,055 ERROR [stderr] Caused by: java.io.EOFException
00:00:12,055 ERROR [stderr] at java.io.DataInputStream.readByte(DataInputStream.java:267)
00:00:12,055 ERROR [stderr]  at org.eclipse.paho.client.mqttv3.internal.wire.MqttInputStream.readMqttWireMessage(MqttInputStream.java:56)
00:00:12,055 ERROR [stderr] at org.eclipse.paho.client.mqttv3.internal.CommsReceiver.run(CommsReceiver.java:100)
00:00:12,055 ERROR [stderr]    ... 1 more

Please help !!

Thanks,
R Chakrabarti


On Friday, March 14, 2014 11:05 AM, ratnopam chakrabarti <ratnopam_ch@xxxxxxxxxxx> wrote:
Hi All,

I am working in an enterprise project and we are using mosquitto broker and mqtt paho client to achieve message communication between our application and other third party applications. From our application we are creating MqttClient to both subscribe and publish operation. While creating the client we are sometimes facing "Client persistence is already in use" exception in the logs. What I suspected is that the client is not closing the previous connection and when we try to create the second client with the same client Id, it is throwing the above error. So I manually closed the connection after processing is done and disconnected. The code snippet - 

MqttClient subClient = new MqttClient(brokerURL, clientId); --- creating the client

For disconnecting ----

client.unsubscribe(configManager.getStringParam(HwaConfigurationConstants.MQTT_SUBSCRIBER_TOPIC) + userId);
client.disconnect(5000);
client.close();

But it still did not work. Then I changed the code a bit to this
MqttClient subClient = new MqttClient(brokerURL, clientId, new MemoryPersistence()); --- creating the client

Now we have not encountered the "Persistence is use " error. But what we are seeing is lot of times "Connection Lost" error is coming in the logs. Any idea here will be highly appreciated as to why this might happen and also if we are creating the client and using persistence in the correct manner.

Thanks,
R Chakrabarti

_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/paho-dev



Back to the top