Closed lujiefsi closed 1 month ago
This can occur due to mqtt transport payload limits. To increase the limit, add the following parameter to the docker container environment:
NETTY_MAX_PAYLOAD_SIZE: 131072
I believe we should fix this bug. The device can send data that exceeds NETTY_MAX_PAYLOAD_SIZE. The platform should log the reason for the RPC failure once upon receiving such data, instead of repeatedly logging the issue.
You can override NETTY_MAX_PAYLOAD_SIZE up to 2 MB (mqtt limit). However, you should make sure that you have enough resources to process large messages. The 64 KB limit has been set by default to prevent performance issues.
@pon0marev
Thank you for your response. The issue I reported is a bug. My device inadvertently sent data exceeding the NETTY_MAX_PAYLOAD_SIZE, causing Thingsboard to continuously print the error log "Message decoding failed: too large message." This behavior interferes with my ability to monitor other logs effectively.
I suggest that when Thingsboard receives data exceeding the NETTY_MAX_PAYLOAD_SIZE, it should log a single warning message instead of continuously printing error logs. This would prevent the logs from being overwhelmed by repeated error messages while still retaining a record of the issue.
Thank you for your understanding and support.
Best regards, Lujiefsi
Did your device send data more than the limit once? Because you should see such a log 1 time per 1 message from the device.
got it
Describe the bug When the RPC response is too large, the log repeatedly shows the following error message:
2024-07-18 10:25:13,394 [nioEventLoopGroup-4-4] ERROR o.t.s.t.mqtt.MqttTransportHandler - [88ddd0b7-2aaf-4c0e-9cc9-47b7fd917d7d] Message decoding failed: too large message: 69877 bytes
These logs appear repeatedly and will overwhelm other logs.Your Server Environment
docker run -it -p 8080:9090 -p 7070:7070 -p 1883:1883 -p 5683-5688:5683-5688/udp -v ~/.mytb-data:/data -v ~/.mytb-logs:/var/log/thingsboard --name mytb --restart always thingsboard/tb-postgres
Your Client Environment
Desktop (please complete the following information):
Your Device client is a python script
import paho.mqtt.client as mqtt import json import time
THINGSBOARD_HOST = '192.168.19.159' ACCESS_TOKEN = '9k5A2H1wPbC0nUZeOmfx'
def on_connect(client, userdata, flags, rc): print("Connected with result code " + str(rc)) client.subscribe("v1/devices/me/rpc/request/+")
def on_message(client, userdata, msg): print("Topic: " + msg.topic) print("Message: " + str(msg.payload)) data = json.loads(msg.payload) if data['method'] == 'getTelemetry':
large_data = {}
client = mqtt.Client() client.on_connect = on_connect client.on_message = on_message
client.username_pw_set(ACCESS_TOKEN)
client.connect(THINGSBOARD_HOST, 1883, 60)
client.loop_start()
try: while True: telemetry_data = {'temperature': 25 + 5 (time.time() % 10), 'humidity': 50 + 5 (time.time() % 10)} client.publish('v1/devices/me/telemetry', json.dumps(telemetry_data), 1) print(f"Sent data: {telemetry_data}") time.sleep(10)
except KeyboardInterrupt: pass
client.loop_stop() client.disconnect()`
To Reproduce Steps to reproduce the behavior:
Expected behavior print only one error meesge.