Edge device constantly reconnects to Losant Broker

Hi guys,

since today my Edge device is constantly disconnecting and reconnecting to the Losant Broker. See the Edge Agent log below:

losant-agent  2021-07-15T12:19:51.193Z [info] Attempting to reconnect to mqtts://broker.losant.com...
 losant-agent  2021-07-15T12:19:51.800Z [info] Connected to: mqtts://broker.losant.com
 losant-agent  2021-07-15T12:19:52.327Z [info] Peripheral device updates received from Losant and applied.
 losant-agent  2021-07-15T12:19:52.386Z [info] Workflows received from Losant and applied.
 losant-agent  2021-07-15T12:20:33.133Z [warn] MQTT client disconnected.
 losant-agent  2021-07-15T12:21:17.725Z [info] Attempting to reconnect to mqtts://broker.losant.com...
 losant-agent  2021-07-15T12:21:18.318Z [info] Connected to: mqtts://broker.losant.com
 losant-agent  2021-07-15T12:21:18.839Z [info] Peripheral device updates received from Losant and applied.
 losant-agent  2021-07-15T12:21:18.891Z [info] Workflows received from Losant and applied.
 losant-agent  2021-07-15T12:21:59.635Z [warn] MQTT client disconnected.
 losant-agent  2021-07-15T12:22:44.227Z [info] Attempting to reconnect to mqtts://broker.losant.com...
 losant-agent  2021-07-15T12:22:44.918Z [info] Connected to: mqtts://broker.losant.com
 losant-agent  2021-07-15T12:22:45.432Z [info] Peripheral device updates received from Losant and applied.
 losant-agent  2021-07-15T12:22:45.484Z [info] Workflows received from Losant and applied.
 losant-agent  2021-07-15T12:23:26.209Z [warn] MQTT client disconnected.
 losant-agent  2021-07-15T12:24:10.800Z [info] Attempting to reconnect to mqtts://broker.losant.com...
 losant-agent  2021-07-15T12:24:11.451Z [info] Connected to: mqtts://broker.losant.com
 losant-agent  2021-07-15T12:24:12.041Z [info] Peripheral device updates received from Losant and applied.
 losant-agent  2021-07-15T12:24:12.092Z [info] Workflows received from Losant and applied.
 losant-agent  2021-07-15T12:24:52.784Z [warn] MQTT client disconnected.
 losant-agent  2021-07-15T12:25:37.375Z [info] Attempting to reconnect to mqtts://broker.losant.com...
 losant-agent  2021-07-15T12:25:38.019Z [info] Connected to: mqtts://broker.losant.com
 losant-agent  2021-07-15T12:25:38.577Z [info] Peripheral device updates received from Losant and applied.
 losant-agent  2021-07-15T12:25:38.582Z [info] Workflows received from Losant and applied.
 losant-agent  2021-07-15T12:26:19.330Z [warn] MQTT client disconnected.
 losant-agent  2021-07-15T12:27:03.921Z [info] Attempting to reconnect to mqtts://broker.losant.com...
 losant-agent  2021-07-15T12:27:04.571Z [info] Connected to: mqtts://broker.losant.com
 losant-agent  2021-07-15T12:27:05.099Z [info] Peripheral device updates received from Losant and applied.
 losant-agent  2021-07-15T12:27:05.152Z [info] Workflows received from Losant and applied.
 losant-agent  2021-07-15T12:27:45.973Z [warn] MQTT client disconnected.

While in Losant the device logs are:

This was working fine yesterday, and nothing changed on the edge. Could it be a bad internet connection? If so, why it keeps reconnecting 1 minute after it disconnects?
I’m a little bit lost here, I’m not sure how I can debug this issue. What else can I see in order to figure out what is going on?

Thanks!

Hello @Nicolas_Mascardi,

Would you happen to have two (or more devices) with the same Device ID trying to connect to Losant at the same time? The reason I ask is that the message you are getting when the device disconnects is “Device establishing new connection, closing previous connection” which means that the same “device” is connecting to Losant while having an already established connection.

Thank you,
Heath

Hey Heath… yes that was the issue… :man_facepalming:t2: I had an instance of the edge agent running in my laptop that was pointing to the same device. The instance was stopped but after a docker upgrade, it automatically started and generated the conflict.

Thanks!!

1 Like