cxbrooks / test

Second test for bugzilla to git
0 stars 0 forks source link

CapeCode MQTT accessor leaves threads running and fails to exit #12

Open cxbrooks opened 7 years ago

cxbrooks commented 7 years ago

Note: the issue was created automatically with bugzilla2github tool

Original bug ID: BZ#543 From: @cxbrooks Reported version: unspecified CC: accessors-devel@terraswarm.org

cxbrooks commented 7 years ago

Running

$PTII/bin/ptinvoke ptolemy.moml.MoMLSimpleApplication ptolemy/actor/lib/jjs/modules/mqtt/demo/MQTTPubSub/MQTTPubSub.xml

fails to exit after the model wraps up.

jstack shows the following threads:

--start--

Full thread dump Java HotSpot(TM) 64-Bit Server VM (25.101-b13 mixed mode):

"Attach Listener" BZ#46 daemon prio=9 os_prio=31 tid=0x00007ff86717a000 nid=0x5a0b waiting on condition [0x0000000000000000] java.lang.Thread.State: RUNNABLE

"DestroyJavaVM" BZ#27 prio=5 os_prio=31 tid=0x00007ff86721f800 nid=0x1c03 waiting on condition [0x0000000000000000] java.lang.Thread.State: RUNNABLE

"MQTT Call: mqttpt_FC8DAA38CA21D9F7" BZ#21 prio=1 os_prio=31 tid=0x00007ff8617c0800 nid=0x6703 in Object.wait() [0x0000700009a34000] java.lang.Thread.State: WAITING (on object monitor) at java.lang.Object.wait(Native Method)

"MQTT Snd: mqttpt_FC8DAA38CA21D9F7" BZ#20 prio=1 os_prio=31 tid=0x00007ff8612a4000 nid=0x6503 in Object.wait() [0x0000700009931000] java.lang.Thread.State: TIMED_WAITING (on object monitor) at java.lang.Object.wait(Native Method)

"MQTT Call: mqttpt_C7CF5AE1A4F8D261" BZ#17 prio=1 os_prio=31 tid=0x00007ff864800800 nid=0x6103 in Object.wait() [0x000070000972b000] java.lang.Thread.State: WAITING (on object monitor) at java.lang.Object.wait(Native Method)

"MQTT Snd: mqttpt_C7CF5AE1A4F8D261" BZ#16 prio=1 os_prio=31 tid=0x00007ff864803000 nid=0x5f03 in Object.wait() [0x0000700009628000] java.lang.Thread.State: TIMED_WAITING (on object monitor) at java.lang.Object.wait(Native Method)

--end---

To fix this, we need to stop these threads.

Wrapup is calling MQTTHelper.end():

public void end() throws MqttException { if (_mqttClient.isConnected()) { _mqttClient.disconnect(); } _mqttClient.close(); }

https://www.eclipse.org/forums/index.php/t/1073983/ suggests upgrading or calling MqttClient.setTimeToWait().

Upgrading to 1.0.2 from http://central.maven.org/maven2/org/eclipse/paho/org.eclipse.paho.client.mqttv3/1.2.0/ does not solve the problem, though a different set of threads is seen in jstack.

I did not try calling setTimeToWait().