MQTT connection threads are getting hanged. [message #1221841] |
Wed, 18 December 2013 09:29  |
Eclipse User |
|
|
|
Hi,
I am not sue is this the right forum to post mqtt issue if not please advise the right forum to post.
I am using paho mqtt java client for publishing, i am facing the issue with the number of threads getting increased, for each connection there are three threads are getting created with snd,call and rec at some point of time threads are getting exhausted and other threads getting hanged.
I am trying to reuse the connect, but the connection gets disconnected and it creates new connection with new client id at the time of publish by this threads are getting increased and the old threads which are created with previous connection are not getting cleared. We are using only for publish with clean session true and with no call back.
And also the tmp folder is getting full with this new connections even after not setting the persistence while connection
What is the best way to create the connection and reusing the connections instead of creating new connection on every publish. Is it advisable to create new connection and disconnect on every publish.
Here is the track trace from thread dump:
java.lang.Thread.State: WAITING
at java.lang.Object.wait(Native Method)
- waiting on <53000ae6> (a java.lang.Object)
at java.lang.Object.wait(Object.java:503)
at org.eclipse.paho.client.mqttv3.internal.Token.waitForResponse(Token.java:122)
at org.eclipse.paho.client.mqttv3.internal.Token.waitForCompletion(Token.java:90)
at org.eclipse.paho.client.mqttv3.MqttToken.waitForCompletion(MqttToken.java:50)
at org.eclipse.paho.client.mqttv3.MqttClient.publish(MqttClient.java:272)
|
|
|
|
|
|
Re: MQTT connection threads are getting hanged. [message #1264825 is a reply to message #1222287] |
Wed, 05 March 2014 09:34  |
Eclipse User |
|
|
|
Sorry, I seem to have missed your question.
I will answer one point. Your call to
client = new MqttClient(this.brokerUrl, clientId);
means persistence is on - it's the default. If you want to turn persistence off, then you need to call
client = new MqttClient(this.brokerUrl, clientId, null);
Ian
|
|
|
Powered by
FUDForum. Page generated in 0.06513 seconds