-
Notifications
You must be signed in to change notification settings - Fork 72
Cumulocity mapper stuck in a disconnect-reconnect loop when it receives a message more than 1 MiB in size #3124
Description
Describe the bug
When a large payload > 1 MiB is published to the Cumulocity mapper, it gets stuck in a disconnect-reconnect loop at the MQTT client level. This happens because maximum message size configured by the mapper for its connection is just 1 MiB and when it receives any messages exceeding that limit, the embedded mqtt client disconnects itself from the broker and tries to reconnect, only for the same message to be re-delivered which triggers the next disconnection. And this cycle goes on forever.
To Reproduce
Publish a very large event message with a JSON fragment that exceeds 1 MiB in size. Then you'll notice the mapper repeatedly disconnecting and reconnecting in its logs as follows:
Sep 19 11:44:45 6ae4ab4508f7 tedge-mapper[2395]: 2024-09-19T11:44:45.16040775Z ERROR mqtt_channel::connection: MQTT connection error: Mqtt state: Mqtt serialization/deserialization error: payload size limit exceeded: 1048615
Sep 19 11:44:46 6ae4ab4508f7 tedge-mapper[2395]: 2024-09-19T11:44:46.164981578Z INFO mqtt_channel::connection: MQTT connection re-established
Sep 19 11:44:46 6ae4ab4508f7 tedge-mapper[2395]: 2024-09-19T11:44:46.165699133Z ERROR mqtt_channel::connection: MQTT connection error: Mqtt state: Mqtt serialization/deserialization error: payload size limit exceeded: 1048615
Sep 19 11:44:47 6ae4ab4508f7 tedge-mapper[2395]: 2024-09-19T11:44:47.169036827Z INFO mqtt_channel::connection: MQTT connection re-established
Sep 19 11:44:47 6ae4ab4508f7 tedge-mapper[2395]: 2024-09-19T11:44:47.169553586Z ERROR mqtt_channel::connection: MQTT connection error: Mqtt state: Mqtt serialization/deserialization error: payload size limit exceeded: 1048615
Expected behavior
The mapper should receive the message and drop it, if it can't be forwarded to the cloud, with an appropriate error message logged.
Additional context
The same limitation message size limitation exists for the other cloud mappers as well and even the agent, but with a higher message size limit of 10 MiB. The fix must cover them all.