eclipse / mosquitto

Eclipse Mosquitto - An open source MQTT broker
https://mosquitto.org
Other
8.61k stars 2.33k forks source link

mosquitto 2.0.11/2.0.18 Bridge => disconnected due to malformed packet on retained packet #3073

Open hb9eue opened 1 week ago

hb9eue commented 1 week ago

Hi

I'm aware 2.0.11 is not the latest version, but I found no indication that this is a known and fixed issue with newer versions.

I'm bridging my local mosquitto broker with the meshtastic broker. This worked fine for several months but as the user number has grown significantly suddnely it stopped working and I get disconnected because of malformed packets:

connection_messages true
log_type all

connection Meshtastic
address mqtt.meshtastic.org:1883
topic # both 0 meshtastic/msh/ msh/
remote_username meshdev
remote_password large4cats
#try_private false
cleansession true
#bridge_protocol_version mqttv50
#bridge_max_packet_size 1000

But my broker disconnects the bridge while getting the initial retained messages:

1719124778: Received PUBLISH from local.pine64.Meshtastic (d0, q0, r1, m0, 'meshtastic/msh/IN/Bir/D1/2/stat/!da52924c', ... (7 bytes))
1719124778: Received PUBLISH from local.pine64.Meshtastic (d0, q0, r1, m0, 'meshtastic/msh/IN/Bir/D1/2/stat/!aba8f51a', ... (6 bytes))
1719124778: Received PUBLISH from local.pine64.Meshtastic (d0, q0, r1, m0, 'meshtastic/msh/IN/Bir/Alft/2/stat/!da52924c', ... (6 bytes))
1719124778: Received PUBLISH from local.pine64.Meshtastic (d0, q0, r1, m0, 'meshtastic/msh/IN/Bir/Alft/2/stat/!aba8f51a', ... (6 bytes))
1719124778: Received PUBLISH from local.pine64.Meshtastic (d0, q0, r1, m0, 'meshtastic/msh/IN/Bir/BU/2/stat/!da529480', ... (6 bytes))
1719124778: Received PUBLISH from local.pine64.Meshtastic (d0, q0, r1, m0, 'meshtastic/msh/IN/D1/2/stat/!da528f34', ... (7 bytes))
1719124778: Received PUBLISH from local.pine64.Meshtastic (d0, q0, r1, m0, 'meshtastic/msh/IN/D1/2/stat/!da529480', ... (7 bytes))
1719124778: Received PUBLISH from local.pine64.Meshtastic (d0, q0, r1, m0, 'meshtastic/msh/IN/KS/2/stat/!da5773a4', ... (7 bytes))
1719124778: Received PUBLISH from local.pine64.Meshtastic (d0, q0, r1, m0, 'meshtastic/msh/PARCmesh/2/stat/!da622644', ... (7 bytes))
1719124778: Received PUBLISH from local.pine64.Meshtastic (d0, q0, r1, m0, 'meshtastic/msh/PARCmesh/2/stat/paho46760577251754', ... (7 bytes))
1719124778: Received PUBLISH from local.pine64.Meshtastic (d0, q0, r1, m0, 'meshtastic/msh/PARCmesh/2/stat/paho54871366988095', ... (7 bytes))
1719124778: Received PUBLISH from local.pine64.Meshtastic (d0, q0, r1, m0, 'meshtastic/msh/PARCmesh/2/stat/paho55462593669862', ... (7 bytes))
1719124778: Received PUBLISH from local.pine64.Meshtastic (d0, q0, r1, m0, 'meshtastic/msh/TRIG/2/stat/!c34472b5', ... (7 bytes))
1719124778: Client local.pine64.Meshtastic disconnected due to malformed packet.

Sometimes, when I delete the last topic which was published this seems to solve the issue, only to fail on another one.

When I look at the transactions via wireshark, I don't see any obvious problems. It's hard to tell, as all topics are transmitted in one huge transaction.

I wonder if this could be due to a limitation of the receive buffer or similar.

I attempted to switch to protocol 50 but that did not resolve the issue.

Maybe somebody could get me more insight on how to further pin down the cause of that issue?

-Benoit-

hb9eue commented 1 week ago

I suppose it has to do with the number of retained messages received upon connection. If I subscribe to a more specific topic, limiting the number of retained messages received upon connection, I don't get disconnects in the very same topic I got disconnected before.

ckrey commented 2 days ago

subscribe using mosquitto_sub -t 'msh/#' -h mqtt.meshtastic.org -u meshdev -d encounters a similar problem as the bridge: It detects an error and reconnects every few seconds

There seems to be a problem with high volume incoming data

hb9eue commented 2 days ago

The 'high volume' on connection is due to the large number of retained topics and expected.

hb9eue commented 1 day ago

Installed 2.0.18 from https://repo.mosquitto.org/ issue persists.