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

It's difficult to pinpoint without more information.  The first place I would look is in the mosquitto log to see if there is any more information there.

The previous connection will need to be closed before opening a new one.  You say that

"What I suspected is that the client is not closing the previous connection"

How are you expecting the connection to be closed?  At what point do you create a new client instance?


On 03/17/2014 03:24 PM, ratnopam chakrabarti wrote:

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

00:00:12,054 ERROR [stderr] Connection lost (32109) -
00:00:12,054 ERROR [stderr] (MQTT Rec: ATTDriver1)      at
00:00:12,054 ERROR [stderr] at
00:00:12,055 ERROR [stderr] Caused by:
00:00:12,055 ERROR [stderr] at
00:00:12,055 ERROR [stderr]  at org.eclipse.paho.client.mqttv3.internal.wire.MqttInputStream.readMqttWireMessage(
00:00:12,055 ERROR [stderr] at
00:00:12,055 ERROR [stderr]    ... 1 more

Please help !!

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);

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.

R Chakrabarti

paho-dev mailing list

paho-dev mailing list

Ian Craggs                          
icraggs@xxxxxxxxxx                 IBM United Kingdom
Committer on Paho, Mosquitto

Back to the top