Closed
Description
I am working on an python app that gets stuck somewhere in the MQTT.Connect() Method, but only after a while. it might work 1000 times than hang. I decided to create a simple test by changing basicPubSub.py to do something similar and it still hangs. Here is what i've done to basicPubSub:
Everything above the While loop is the same (except my creds).
while True:
print "waiting"
time.sleep(3)
data = { "xg": 2.5, "xalarm": 3, "linkqdbm": -25}
JSONPayload = dumps(data) #json.dumps
myAWSIoTMQTTClient.connect() #this will hang eventually and never throw an exception or continue or update the logger
myAWSIoTMQTTClient.publish("Sensor/", JSONPayload, 0) #this was orgonally 1; We probably want 1 for final app but I dont think it matters here
myAWSIoTMQTTClient.disconnect()
Here is what the output looks like... and what I get when I keyboard interrupt the hang. I waited like an hour before doing so.
waiting
2017-04-13 19:30:11,718 - AWSIoTPythonSDK.core.protocol.mqttCore - INFO - Connection type: TLSv1.2 Mutual Authentication
2017-04-13 19:30:12,208 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Connect result code 0
2017-04-13 19:30:12,211 - AWSIoTPythonSDK.core.protocol.mqttCore - INFO - Connected to AWS IoT.
2017-04-13 19:30:12,211 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Connect time consumption: 70.0ms.
2017-04-13 19:30:12,212 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Try to put a publish request 1998 in the TCP stack.
2017-04-13 19:30:12,212 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Publish request 1998 succeeded.
2017-04-13 19:30:12,213 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Disconnect result code 0
2017-04-13 19:30:12,223 - AWSIoTPythonSDK.core.protocol.mqttCore - INFO - Disconnected.
2017-04-13 19:30:12,224 - AWSIoTPythonSDK.core.protocol.mqttCore - DEBUG - Disconnect time consumption: 10.0ms.
waiting
2017-04-13 19:30:15,227 - AWSIoTPythonSDK.core.protocol.mqttCore - INFO - Connection type: TLSv1.2 Mutual Authentication
^CTraceback (most recent call last):
File "TestScripts/basicPubSub.py", line 108, in <module>
myAWSIoTMQTTClient.connect()
File "/usr/local/lib/python2.7/dist-packages/AWSIoTPythonSDK/MQTTLib.py", line 403, in connect
return self._mqttCore.connect(keepAliveIntervalSecond)
File "/usr/local/lib/python2.7/dist-packages/AWSIoTPythonSDK/core/protocol/mqttCore.py", line 290, in connect
self._pahoClient.connect(self._host, self._port, keepAliveInterval) # Throw exception...
File "/usr/local/lib/python2.7/dist-packages/AWSIoTPythonSDK/core/protocol/paho/client.py", line 655, in connect
return self.reconnect()
File "/usr/local/lib/python2.7/dist-packages/AWSIoTPythonSDK/core/protocol/paho/client.py", line 798, in reconnect
ciphers=self._tls_ciphers)
File "/usr/lib/python2.7/ssl.py", line 891, in wrap_socket
ciphers=ciphers)
File "/usr/lib/python2.7/ssl.py", line 566, in __init__
self.do_handshake()
File "/usr/lib/python2.7/ssl.py", line 788, in do_handshake
self._sslobj.do_handshake()
KeyboardInterrupt
I am using Python 2.7.9, OpenSSL 1.0.1t, and AWSIoTPythonSDK 1.1.1
Any thoughts on how to overcome this?
Metadata
Metadata
Assignees
Labels
No labels