OTAA Error: DevNonce has already been used

Hi,
I am running Chirpstack V4 using Docker. And two devices that were already connected for several weeks suddenly were not able to join again due to “DevNonce has already been used”.

The devices are configured as : LoRawAN 1.0.2 OTAA

I tried to “Flush OTAA device nonces” but it doesn’t seem to have any effect. Anyone has an idea for a solution?

The Events from the devices are sending an OTAA Error every few seconds
time:“2023-12-04T14:50:46.847431401+00:00”
deviceInfo
tenantId:“3bcb7cf1-efa0-48dc-9acb-9243ba42eb04”
tenantName:“—”
applicationId:“5ba72fe2-8c11-4ae4-ab20-6bd6fb35de70”
applicationName:“—”
deviceProfileId:“2a55c519-6a1b-4a6a-9682-825cfb8036ec”
deviceProfileName:“—”
deviceName:“FB_BIUN”
devEui:“94193a010b003d3c”
deviceClassEnabled:“CLASS_A”
tags:
level:“ERROR”
code:“OTAA”
description:“DevNonce has already been used”
context
deduplication_id:“2941fbb0-b8ac-4151-833b-cd440e923190”

LoRaWAN frames from a device: it is sending join requests constantly
phy_payload
mhdr
m_type:“JoinRequest”
major:“LoRaWANR1”
0:9
1:199
2:80
3:104
dev_eui:“94193a010b003d3c”
dev_nonce:33846
join_eui:“94193a030b000001”

I’ve tried to empty the dev_nonces column in postgres for the device but then I get a join from a few days ago and then the OTAA Error occurs again:

This may be a legitimate bug. That button/API call appears to reset the dev_nonces, but not join_nonce, leaving it to continue erroring at the max value:

chirpstack=# SELECT dev_nonces, join_nonce FROM device_keys WHERE dev_eui = '\x00mydev';
 dev_nonces | join_nonce 
------------+------------
 {}         |         12
(1 row)

@brocaar Should join_nonce also be reset?

In the meantime, you may have luck setting join_nonce back to 0 for your device’s row in the device_keys table.

Was it doing this before the DevNonces were exhausted, or only after? Either way, some sort of backoff should be used.

Going back to the bigger picture, this is the crux of the issue. There’s no way a well-behaved firmware should exhaust all DevNonces in a few weeks. I would look into what’s happening and why so many joins are taking place (LoRaWAN frames, logs, etc).

Thank you for your answer, resetting both dev_nonces and join_nonce didn’t solve it
after resetting I get: dev_nones = {33836} and join_nonce = 1

Hereby the device_log_messages on the moment the error started:

Might it be a problem with the gateway and not chirpstack? The gateway is a Kerlink izeptocell connected with just 2 devices
Hereby the logs from the chirpstack gateway bridge (4.0.10) (hosted on the server not on the gateway)

Have you resolve this issue? My device works on chirpstack3 but on chirpstack4 all I got is DevNonce has already been used.
Screenshot from 2024-02-29 13-58-40

Hi vladosam,
I’m not sure what the issue was, but it seems to have been caused from a network problem with the Kerlink gateway, which I had no control over. Unfortunately, I wasn’t able to investigate further.

1 Like

Hi,

I am on same issue ! Can you give some input from your debugging !

Try to disable frame counter. If that fix your problem then you probably have code problem like I’ve had.

if you are talking about Disable frame-counter validation , it’s already disabled.

So what next as you told code problem ???

I used Radiolib library LoRaWAN_End_Device example and I removed counter part of code. Once I add that back everything started to work. I also upgraded chirpstack to v4.

Thanks for the reply , I am not getting the exact problem can you describe why this stuff happened ? because on LAN network everything was working fine I have shifted gateway on GSM network 2 days back and this issue occured !

I am just starting with lora so I really can’t help you any more. But as you’re problems started one you moved gateway to gsm look for rx_delay. I saw that people were having problems on gsm.

Okay I will check and update you !

I used to use Dragino gateway with 4G in AS923. No issue with the default rx delay.

FYI only.

1 Like