disk91 / helium-chirpstack-community

Glue between helium and chirpstack
20 stars 6 forks source link

Network Session Key doesn't get updated after MQTT reconnect #66

Closed vkynchev closed 1 year ago

vkynchev commented 1 year ago

I've stumbled across an issue with uplinks. A device is able to join at all times - DevEUI is added to OUI routing information. On a join event the NSK (Network Session Key) gets updated in OUI routing information and later uplinks and downlinks are all being sent out fine.

In a case where MQTT connection drops or the clients are kicked out of the server (either manually or for some mqtt server reason) the NSK never gets updated in OUI routing and following uplinks are never delivered to Chirpstack.

I'm attaching screenshots from the application logs (UTC timezone) + device serial logs showing the obtained keys (EEST timezone)

Occurence 1:

Application logs: Screenshot 2023-08-07 at 22 09 32

Successful join (with updated NSK): Screenshot 2023-08-07 at 22 09 51

Successful join after MQTT reconnection: Screenshot 2023-08-07 at 22 17 26

Occurence 2:

Application logs: Screenshot 2023-08-07 at 22 12 10

Successful join after MQTT reconnection: Screenshot 2023-08-07 at 22 12 15

disk91 commented 1 year ago

Hello, This is a known problem i’ll fix in tte coming days. Currently when mqtt restart, you must restart helium contained. Paul

vkynchev commented 1 year ago

@disk91 I've already fixed it, it's in the same PR as the redis ssl fix. 🙂

PS: I've created the github issue to document the exact issue I'm fixing in case you didn't know about that.

disk91 commented 1 year ago

Yes i’ve seen that. But i want to fix it differently. Better not to make fat pull request. Please split topic in different branches so it will be easier to me to merge that can be directly merge and reject what i’ll manage differently. btw. Thank you for contributing

disk91 commented 1 year ago

integrated in 1.3.0