Long topics cause incorrect logging messages
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
mosquitto |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
Section 2.2 of the MQTT spec says "The topic name is a UTF-encoded string. See the section on MQTT and UTF-8 for more information. Topic name has an upper length limit of 32,767 characters."
This is in keeping with all strings in mqtt being utf8, with two bytes for the length before hand.
However, posting to a topic as short as 6-700 bytes causes the topic to be garbled when received by the subscriber...
log from publisher....
C:\tools\
jjjjjjjjjjjjjjj
jjjjjjjjjjjjjjj
jjjjjjjjjjjjjjj
jjjjjjjjjjjjjjj
jjjjjjjjjjjjjjj
jjjjjjjjjjjjjjj
jjjjjjjjjjjjjjj
jjjjjjjjjjjjjjj
jjjjjjjjjjjjjjj
(701 bytes topic, plus 3 bytes payload)
C:\tools\
log from subscriber....
C:\tools\
Received CONNACK
Received SUBACK
Subscribed (mid: 1): 0
Received PUBLISH (d0, q0, r0, m0, 'jjjjjjjjjjjjjj
jjjjjjjjjjjjjjj
jjjjjjjjjjjjjjj
jjjjjjjjjjjjjjj
jjjjjjjjjjjjjjj
jjjjjjjjjjjjjjj
jjjjjjjjjjjjjjj
zzz
Sending PINGREQ
Received PINGRESP
(payload is correct, but topic is garbage after 465 bytes)
I've observed the same behaviour with my own client library. (I was testing that my library correctly published to a long topic)
Changed in mosquitto: | |
milestone: | none → 0.10.2 |
status: | New → Fix Committed |
Changed in mosquitto: | |
status: | Fix Committed → Fix Released |
I've not been able to reproduce this, but I've only got easy access to Linux right now. I'll try on Windows when I can. I tried various lengths including up to 30000 characters and they all seemed fine.