thingsboard / thingsboard-gateway

Open-source IoT Gateway - integrates devices connected to legacy and third-party systems with ThingsBoard IoT Platform using Modbus, CAN bus, BACnet, BLE, OPC-UA, MQTT, ODBC and REST protocols
https://thingsboard.io/docs/iot-gateway/what-is-iot-gateway/
Apache License 2.0
1.74k stars 844 forks source link

[BUG] After a while, the packet We send from the mqtt connector does not reach the thingsboard server. #658

Closed gohm-tech closed 2 years ago

gohm-tech commented 2 years ago

The thingsboard-gateway service stops sending data to the server after running for a certain period of time. When I restart the thingsboard-gateway service, it starts sending again.

That is the server code. The part marked in yellow is our gateway's acces token. We could not see any logs containing the acces token of our gateway when it did not send the data to the server. After restarting the thingsboard-gateway service, these logs started to appear. Screenshot from 2021-12-20 08-50-54

That is our code log. Screenshot from 2021-12-21 13-48-09

That is connector log. Screenshot from 2021-12-21 13-47-57

That is the MQTT broker log we connect and subscribe. Screenshot from 2021-12-21 13-53-34

Server Environment own setup docker deployment OS: Linux(Ubuntu 20.04)

Client Environment OS: Linux(Ubuntu) Browser: Chrome, Firefox Version Ubuntu Version 20.04

Connector name MQTT Connector

Configuration mqtt.txt tb_gateway.txt

Versions: OS: Raspbian GNU/Linux 10 (buster) Thingsboard IoT Gateway version [e.g. 2.7] Python version 3.7.3

Best Regards, Gohm Team

samson0v commented 2 years ago

Hi @gohm-tech, please, set DEBUG level in the config/logs.conf file and provide more info. Thanks for your interest in ThingsBoard IoT Gateway!

gohm-tech commented 2 years ago

Hi @samson0v, We already set DEBUG level the all of the log levels. We did not see any error in the log files. Everythings look good.Best Regards, Gohm Team

samson0v commented 2 years ago

@gohm-tech, after about how long do Gateway stop sending data?

gohm-tech commented 2 years ago

Hi @samson0v, We test it again. There are the logs. service.log connector.log thingsboard_server.log 1 2 3

Note: The server clock is 3 hours behind.

gohm-tech commented 2 years ago

Hi @samson0v,

Do you think it can be related to our thingsboard-gateway version?

Regards, Gohm Team

gohm-tech commented 2 years ago

Hi @samson0v,

We created two new gateways. One of them has the 2.7 version and the other has the latest version. (The reason we use version 2.7 is high CPU usage in the latest version). We have created a service that will send data over an MQTT connector per second. We think that this way we can understand whether the error is caused by the version.

Have you encountered such an error before? Do you have any ideas as to why this error might occur?

Regards, Gohm Team

samson0v commented 2 years ago

Hi @gohm-tech, we released a new version of Gateway 3.0 (include a High CPU usage fix), so I think it will be better if you completely delete all versions of Gateways you have, install the new (3.0) one and send the logs from it. Thanks for your interest in ThingsBoard IoT Gateway!

gohm-tech commented 2 years ago

Hi @samson0v,

Thanks for your interest. Thanks for this information too. After the testing we realized something. thingsboard-gateway and this code are working together. We have created a service for working continuously to mqtt_client_firmware.py code. This code wants to subscribe same topics. So we were getting this error #643. After getting this error we change the ACTORS_MAX_CONCURRENT_SESSION_PER_DEVICE parameter. After doing this we thought the error was resolved. But in this test environment, we disabled the service of mqq_client_firmware.py code. After doing this, the error did not occur. In short, the error occurs as a result of multiple MQTT subscribe.

Regards, Gohm Team