Category
Other
Hardware
Station G2
Firmware Version
2.5.1.88935296
Description
When initially connecting to MQTT a queued message for MQTT that is rather long will cause a panic and reboot. In src/mqtt/MQTT.cpp:471 the buffer is defined as:
static uint8_t bytes[meshtastic_MeshPacket_size + 64];
size_t numBytes = pb_encode_to_bytes(bytes, sizeof(bytes), &meshtastic_ServiceEnvelope_msg, env);
meshtastic_MeshPacket_size is 367, which gives a sum of 431. This probably should be changed to:
static uint8_t bytes[meshtastic_MqttClientProxyMessage_size];
size_t numBytes = pb_encode_to_bytes(bytes, sizeof(bytes), &meshtastic_ServiceEnvelope_msg, env);
(meshtastic_MqttClientProxyMessage_size is 501)
Note that other bugs complaining about "reboot loops after enabling wifi" or similar may also be due to this bug.
Relevant log output
DEBUG | ??:??:?? 49 [Router] MQTT onSend - Publishing encrypted message
INFO | ??:??:?? 49 [Router] MQTT not connected, queueing packet
INFO | ??:??:?? 53 [mqtt] Using non-TLS-encrypted session
INFO | ??:??:?? 53 [mqtt] Attempting to connect directly to MQTT server mqtt.bayme.sh, port: 1883, username: meshdev, password: ....
INFO | ??:??:?? 53 [mqtt] MQTT connected
INFO | ??:??:?? 53 [mqtt] Subscribing to msh/US/bayarea/2/e/......../+
INFO | ??:??:?? 53 [mqtt] Subscribing to msh/US/bayarea/2/e/PKI/+
DEBUG | ??:??:?? 53 [mqtt] Publishing enqueued MQTT message
ERROR | ??:??:?? 53 [mqtt] Panic: can't encode protobuf reason='bytes size exceeded'
��@INFO | ??:??:?? 1
//\ E S H T /\ S T / C
INFO | ??:??:?? 1 Booted, wake cause 0 (boot count 1), reset_reason=reset
Category
Other
Hardware
Station G2
Firmware Version
2.5.1.88935296
Description
When initially connecting to MQTT a queued message for MQTT that is rather long will cause a panic and reboot. In src/mqtt/MQTT.cpp:471 the buffer is defined as:
meshtastic_MeshPacket_sizeis 367, which gives a sum of 431. This probably should be changed to:(
meshtastic_MqttClientProxyMessage_sizeis 501)Note that other bugs complaining about "reboot loops after enabling wifi" or similar may also be due to this bug.
Relevant log output