[PROPERTIES] received invalid property id 105, disconnecting
hollymcr opened this issue · 2 comments
I don't understand the code well enough to make sense of what I am seeing here, but I am sometimes getting exceptions thrown in MqttPackageHandler._handle_publish_packet() due to the returned value of properties from qttPackageHandler._parse_parameters() being None:
[PROPERTIES] received invalid property id 105, disconnecting
[ERROR HANDLE PKG]
Traceback (most recent call last):
File "/usr/local/lib/python3.7/dist-packages/gmqtt/mqtt/handler.py", line 389, in __call__
result = self._handle_packet(cmd, packet)
File "/usr/local/lib/python3.7/dist-packages/gmqtt/mqtt/handler.py", line 214, in _handle_packet
handler(cmd, packet)
File "/usr/local/lib/python3.7/dist-packages/gmqtt/mqtt/handler.py", line 326, in _handle_publish_packet
properties['dup'] = dup
TypeError: 'NoneType' object does not support item assignment
2
Looking at the code in _handle_connack_packet, a test is made for None and a call to self.disconnect() queued. But _handle_publish_packet() makes no such test, before assuming that properties is a Dict that can be assigned to.
Should there be a test here leading to a disconnect (as elsewhere)? That the error message from _parse_parameters says "disconnecting" but then doesn't attempt to (depending on where it is called from) suggests this is a suitable fix but I don't know what the implications might be.