1technophile / OpenMQTTGateway

MQTT gateway for ESP8266 or ESP32 with bidirectional 433mhz/315mhz/868mhz, Infrared communications, BLE, Bluetooth, beacons detection, mi flora, mi jia, LYWSD02, LYWSD03MMC, Mi Scale, TPMS, BBQ thermometer compatibility & LoRa.
https://docs.openmqttgateway.com
GNU General Public License v3.0
3.56k stars 785 forks source link

MQTT reconnection error: OpenMQTTGateway already connected, closing old connection. #1161

Closed mr-orange closed 11 months ago

mr-orange commented 2 years ago

Before submitting a problem please check the troubleshooting section https://docs.openmqttgateway.com/upload/troubleshoot.html

Describe the bug My 0.9.9 cc1101 - RF gateway disconnect and reconnect to mqtt client with error: err mosquitto[14343]: Client OpenMQTTGateway_multi_receiver already connected, closing old connection. This happen every minutes and in some cases every 10 or 30 seconds. If the error is reported for long period of times the lan connection to the device is completely lost. On the same lan the Olimex WIFI BT gateway does present this error sporadically only 2 or 3 per day. Let me know how I can help you to find this bug.

To Reproduce Wait a few minutes after restart ?

Expected behavior No reconnection error

Screenshots If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

Additional context Add any other context about the problem here.

1technophile commented 2 years ago

Could you check that the gateways have 2 different names, frequent disconnections can be due to having several gateways configured with the same client_id (=gateway_name)

mr-orange commented 2 years ago

I see different names in mqtt explorer, but i do not know if the name is the client id. [image: immagine.png]

in my system log I have: [image: immagine.png]

In Home Assistant I see: [image: immagine.png]

On Tue, Feb 8, 2022 at 1:45 AM Florian @.***> wrote:

Could you check that the gateways have 2 different names, frequent disconnections can be due to having several gateways configured with the same client_id (=gateway_name)

— Reply to this email directly, view it on GitHub https://github.com/1technophile/OpenMQTTGateway/issues/1161#issuecomment-1032095580, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFK3VCHRM425CSJJQGJIE3U2BRTRANCNFSM5NX3SGOQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>

1technophile commented 2 years ago

I cannot access the images unfortunately

mr-orange commented 2 years ago

Hi Florian I've switched my cc1101 device to pilight version and the gateway is rocksolid on my lan no more connection error on my syslog and gateway reboot my uptime know is around 8 days. I think the problem relies non the multireceiver version and the problem can be memory related. In pilight only version I actually have 240K of free memory while on multi receiver I had around 100K. Probably there is a problem that lead to reboot the esp32 so the device don't know anything about the last connection and during the connection after reboot the syslog error arise. Let me know if I can hel you to track down the problem I will reflash my device.

NorthernMan54 commented 2 years ago

@mr-orange can you share the details needed for recreating the issue? Ie which build, any custom directives applied and any other relevant details.

mr-orange commented 2 years ago

Sorry for the late answer. The issue decribed above was with the 0.9.9 multireceiver version. I use the gateway with home assistant and have a script that fire a loop of pylight rf code every 250ms until the outlet is on or off depending on the code. I think but do not have any proof the gateway reboot and do a reconnection that it's not expired on the broker and so the error arise. Viewing I saw a lot of mqtt log in syslog I see a lot of OpenMQTTGateway already connected, closing old connection. Let me know how I can help.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] commented 11 months ago

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] commented 11 months ago

This issue was closed because it has been inactive for 14 days since being marked as stale.