Graceless handling of the MQTT broker disconnecting
tjhowse opened this issue · 2 comments
tjhowse commented
2020-11-20 09:59:18 INFO Connected to MQTT.
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
self.run()
File "/usr/lib/python3.5/threading.py", line 862, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python3.5/dist-packages/paho/mqtt/client.py", line 3452, in _thread_main
self.loop_forever(retry_first_connection=True)
File "/usr/local/lib/python3.5/dist-packages/paho/mqtt/client.py", line 1779, in loop_forever
rc = self.loop(timeout, max_packets)
File "/usr/local/lib/python3.5/dist-packages/paho/mqtt/client.py", line 1181, in loop
rc = self.loop_read(max_packets)
File "/usr/local/lib/python3.5/dist-packages/paho/mqtt/client.py", line 1574, in loop_read
return self._loop_rc_handle(rc)
File "/usr/local/lib/python3.5/dist-packages/paho/mqtt/client.py", line 2227, in _loop_rc_handle
self._do_on_disconnect(rc, properties)
File "/usr/local/lib/python3.5/dist-packages/paho/mqtt/client.py", line 3360, in _do_on_disconnect
self.on_disconnect(self, self._userdata, rc)
TypeError: _on_disconnect() missing 1 required positional argument: 'rc```
We shouldn't crash on disconnect, and we should try to reconnect.
tjhowse commented
This should be fixed, but leaving it open until the reporter confirms v0.3.5 fixes it.
tjhowse commented
Fix is confirmed. Thanks Виктор!