zigbee2mqtt icon indicating copy to clipboard operation
zigbee2mqtt copied to clipboard

Crash - DatabaseEntry with ID already exists

Open Nezz opened this issue 1 year ago • 1 comments

What happened?

I'm trying to reset three Tradfri lights on the same chandelier. When I do this, Z2M crashes.

[2024-05-10 21:52:36] warning: 	z2m: Device '0x980c33fffef167d8' left the network
Error: DatabaseEntry with ID '19' already exists
    at Database.insert (/app/node_modules/zigbee-herdsman/src/controller/database.ts:38:19)
    at Device.undelete (/app/node_modules/zigbee-herdsman/src/controller/model/device.ts:439:25)
    at Controller.onDeviceJoined (/app/node_modules/zigbee-herdsman/src/controller/controller.ts:573:20)
[21:52:56] INFO: Preparing to start...
[21:52:57] INFO: Socat not enabled
[21:53:02] INFO: Starting Zigbee2MQTT...

What did you expect to happen?

Three lights to get paired, Z2M not to crash

How to reproduce it (minimal and precise)

  1. Attach three lights to the same chandelier (e.g. https://www.zigbee2mqtt.io/devices/LED2201G8.html or https://www.zigbee2mqtt.io/devices/LED1732G11.html)
  2. (Optional, but seems to increase repro rate) Have them paired to Z2M
  3. Reset them using the wall switch using this method: https://www.youtube.com/watch?v=mJm9YpPrGzk

This triggers an undelete which does not seem to be concurrency safe.

Zigbee2MQTT version

1.37.1

Adapter firmware version

221226

Adapter

SONOFF Zigbee 3.0 USB Dongle Plus TI CC2652P + CP2102(N)

Setup

Add-on on HAOS on x86-64

Debug log

Before the crash After the crash

Nezz avatar May 10 '24 19:05 Nezz

Pushed a fix, can you check if it works?

Changes will be available in the dev branch in a few hours from now.

Koenkk avatar May 12 '24 20:05 Koenkk

Pairing multiple lights at once works now 🎉

Nezz avatar Oct 19 '24 09:10 Nezz