cloudio-project / cloudio-endpoint-python

cloud.iO Python endpoint library/client
MIT License
2 stars 3 forks source link

Reconnection problems to cloud.iO #13

Closed boozo-unlimited closed 6 years ago

boozo-unlimited commented 6 years ago

Receiving from time to time a disconnect from cloud.iO server. Then during reconnection procedure the system has problems to reconnect to cloud.iO

boozo-unlimited commented 6 years ago

Got the following problem. See syslog:

Mar 19 13:17:01 endpoint02 CRON[31329]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Mar 19 14:17:01 endpoint02 CRON[31367]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Mar 19 15:17:01 endpoint02 CRON[31391]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Mar 19 16:17:01 endpoint02 CRON[31428]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Mar 19 16:30:47 endpoint02 sh[25462]: 2018-03-19 16:30:47.853 - cloudio.mqttreconnectclient - INFO - Disconnect: 1
Mar 19 16:30:47 endpoint02 sh[25462]: 2018-03-19 16:30:47.856 - cloudio.mqttreconnectclient - INFO - Starting MqttReconnectClient thread
Mar 19 16:30:47 endpoint02 sh[25462]: 2018-03-19 16:30:47.859 - cloudio.mqttreconnectclient - INFO - Mqtt client reconnect thread running...
Mar 19 16:30:47 endpoint02 sh[25462]: 2018-03-19 16:30:47.862 - cloudio.mqttreconnectclient - INFO - Disconnect: 0
Mar 19 16:30:47 endpoint02 sh[25462]: 2018-03-19 16:30:47.863 - cloudio.mqttreconnectclient - INFO - Trying to connect to cloud.iO...
Mar 19 16:30:47 endpoint02 sh[25462]: 2018-03-19 16:30:47.863 - cloudio.mqttreconnectclient - INFO - Starting MqttReconnectClient thread
Mar 19 16:30:47 endpoint02 sh[25462]: 2018-03-19 16:30:47.864 - cloudio.mqttreconnectclient - WARNING - Mqtt client connection thread already/still running!
Mar 19 16:30:47 endpoint02 sh[25462]: 2018-03-19 16:30:47.965 - cloudio.mqttreconnectclient - INFO - Mqtt client reconnect thread running...
Mar 19 16:30:47 endpoint02 sh[25462]: 2018-03-19 16:30:47.966 - cloudio.mqttreconnectclient - INFO - Trying to connect to cloud.iO...
Mar 19 16:30:47 endpoint02 sh[25462]: Traceback (most recent call last):
Mar 19 16:30:47 endpoint02 sh[25462]: File "/home/gibs/scripts/python/cloudio_endpoint_devel/src/cloudio/mqtt_helpers.py", line 305, in _run
Mar 19 16:30:47 endpoint02 sh[25462]: self.connect(self._options)
Mar 19 16:30:47 endpoint02 sh[25462]: File "/home/gibs/scripts/python/cloudio_endpoint_devel/src/cloudio/mqtt_helpers.py", line 123, in connect
Mar 19 16:30:47 endpoint02 sh[25462]: ciphers=None)      # None, 'ALL', 'TLSv1.2', 'TLSv1.0'
Mar 19 16:30:47 endpoint02 sh[25462]: File "/usr/local/lib/python2.7/dist-packages/paho/mqtt/client.py", line 709, in tls_set
Mar 19 16:30:47 endpoint02 sh[25462]: self.tls_set_context(context)
Mar 19 16:30:47 endpoint02 sh[25462]: File "/usr/local/lib/python2.7/dist-packages/paho/mqtt/client.py", line 618, in tls_set_context
Mar 19 16:30:47 endpoint02 sh[25462]: raise ValueError('SSL/TLS has already been configured.')
Mar 19 16:30:47 endpoint02 sh[25462]: ValueError: SSL/TLS has already been configured.
Mar 19 16:30:47 endpoint02 sh[25462]: 2018-03-19 16:30:47.984 - cloudio.mqttreconnectclient - WARNING - Error during broker connect!
Mar 19 16:30:48 endpoint02 sh[25462]: 2018-03-19 16:30:48.085 - cloudio.mqttreconnectclient - INFO - Connection to cloud.iO broker established
Mar 19 16:30:48 endpoint02 sh[25462]: 2018-03-19 16:30:48.086 - cloudio.mqttreconnectclient - INFO - Connected to cloud.iO broker
Mar 19 16:30:48 endpoint02 sh[25462]: Exception in thread mqtt-reconnect-client-endpoint02-endpoint-:
Mar 19 16:30:48 endpoint02 sh[25462]: Traceback (most recent call last):
Mar 19 16:30:48 endpoint02 sh[25462]: File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
Mar 19 16:30:48 endpoint02 sh[25462]: self.run()
Mar 19 16:30:48 endpoint02 sh[25462]: File "/usr/lib/python2.7/threading.py", line 763, in run
Mar 19 16:30:48 endpoint02 sh[25462]: self.__target(*self.__args, **self.__kwargs)
Mar 19 16:30:48 endpoint02 sh[25462]: File "/home/gibs/scripts/python/cloudio_endpoint_devel/src/cloudio/mqtt_helpers.py", line 333, in _run
Mar 19 16:30:48 endpoint02 sh[25462]: self._onConnected()
Mar 19 16:30:48 endpoint02 sh[25462]: File "/home/gibs/scripts/python/cloudio_endpoint_devel/src/cloudio/mqtt_helpers.py", line 287, in _onConnected
Mar 19 16:30:48 endpoint02 sh[25462]: self._onConnectedCallback()
Mar 19 16:30:48 endpoint02 sh[25462]: File "/home/gibs/scripts/python/cloudio_endpoint_devel/src/cloudio/endpoint.py", line 284, in _onConnected
Mar 19 16:30:48 endpoint02 sh[25462]: success = self.subscribeToSetCommands()
Mar 19 16:30:48 endpoint02 sh[25462]: File "/home/gibs/scripts/python/cloudio_endpoint_devel/src/cloudio/endpoint.py", line 155, in subscribeToSetCommands
Mar 19 16:30:48 endpoint02 sh[25462]: (result, mid) = self._client.subscribe(u'@set/' + self.getUuid().toString() + '/#', 1)
Mar 19 16:30:48 endpoint02 sh[25462]: File "/home/gibs/scripts/python/cloudio_endpoint_devel/src/cloudio/mqtt_helpers.py", line 211, in subscribe
Mar 19 16:30:48 endpoint02 sh[25462]: return self._client.subscribe(topic, qos)
Mar 19 16:30:48 endpoint02 sh[25462]: AttributeError: 'NoneType' object has no attribute 'subscribe'
Mar 19 17:17:01 endpoint02 CRON[31454]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Mar 19 18:17:01 endpoint02 CRON[31496]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Mar 19 19:17:01 endpoint02 CRON[31518]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
boozo-unlimited commented 6 years ago

Fixed in fc9391d.