Repository navigation
Conversation
|
Don't think we want that low a time frame. I've never had either of the two opposite scenario, so, not sure what's a good value here... Most tx-related spec timeouts are around 8sec, we may want to start closer to that; we can adjust later from more feedback. Note that none of this will fix a device stuck in retransmit loop even after receiving a default response. Also, Zigbee 4.0 enforces duplicate rejection at APS layer, so, it may not matter much, in the medium-to-long term, these devices may become entirely broken. |
|
Fair enough — one measured device is not a basis for a global timing decision, and the suppression of heavy retransmitters is worth keeping. Raised the window to 8 s, in the order of the spec's transmit timeouts rather than the few milliseconds stack-level duplicates actually need. Test moved to 8 s with it. Worth separating the two things, though, because the failure this fixes does not depend on the window being short: the problem is that the check has no time limit. A device whose firmware does not increment the ZCL transaction sequence number on retransmit gets exactly one default response, ever — every later copy is dropped forever. With 8 s, a device retransmitting at 3–5 frames/s is answered once per window instead of never: the flood is still suppressed by ~97 %, and the device can get out of the loop. Happy to go higher if you prefer — the point is that it should be finite. |
|
Field data in support of this change, from a production mesh where the deadlock hit most of the routers at once. Setup: Z2M 2.13.0 / zigbee-herdsman 10.8.0, What we saw:
What a re-sent default response does:
So on this hardware, a device stuck in the loop does recover once a default response actually reaches it. The deadlock is the permanent dedupe, not the device. With an 8 s window these devices would get one answer per 8 s instead of none. On a lossy path, recovery takes longer than with our 1–2 s workaround (worst case a few minutes), but it does recover, and that is the important part. |
|
Thanks for taking the time to capture all this — 22 devices on different hardware is a far better basis than my single breaker. Two things in your data answer the open questions here better than my one sample could:
And your deployment addresses the "this won't fix a device stuck in a retransmit loop" concern directly: it did recover, as soon as an answer actually reached it — ~60 msg/s down to ~5, and the frozen meters reporting voltage and energy again. On the window size: your workaround re-answered every 1–2 s and recovery took under a minute, with up to ~20 re-answers for the worst device. At 8 s that worst case becomes a few minutes instead. I kept 8 s because it is the value @Nerivec suggested (in the order of the spec's transmit timeouts), and because the property that matters is that the window is finite at all rather than its exact length — but your numbers are a fair argument that something lower recovers faster on a lossy mesh. Happy to adjust if the maintainers prefer. |
|
22 same devices is still just 1 sample in this regard. This PR is a global behavior, so the goal is to be "fine for all devices" (as opposed to targeting a few). We can always lower the number in the future if we see no issue crop up. The stuck in retx loop scenario I mentioned was for devices that are actually stuck, no matter if a default rsp is sent or not. |
|
Ok, thanks! By the way, I'm using a translator because English is not my first language :) |
I agree, that single device is not a wide sample, and as stated, problem was solvable by using custom converter, although it took me a lot of time to investigate the issue and notice the sympthoms. Nevertheless, I found it surprising, that herdsman didn't repeat |
|
Correcting bad behavior is always tricky, you fix it for one, break it for another... It's whac-a-mole! 🥵 @Dukakz can you reduce the size of the comments to be more to-the-point before we merge this? |
|
Observed the same issue with a Tuya 2CT ( One manually re-sent default response immediately restored all measurements. I’ve backported the eight-second change; readings remain normal after restart. Waiting for a natural recurrence to verify automatic recovery. |
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
A single measured device is not a basis for a global timing decision, and the existing check also guards against devices that retransmit heavily for no good reason. Keep that suppression by sizing the window in the order of the spec's transmit timeouts instead of the few milliseconds duplicates actually need. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Andy <andrei_lazarov@yahoo.com>
8e47505 to
b923090
Compare
|
Field data from an Ember setup, on the window size and on whether a stuck device recovers once it gets a response. Setup: Zigbee2MQTT 2.14.3, zigbee-herdsman 11.2.0, ember adapter, ZBDongle-E (EmberZNet 7.4.4), ~54 devices. Floods started after upgrading to 2.14.3. All the affected devices are Tuya mains devices. 1. The duplicate check left a device stuck ( 2. Re-answering alone wasn't enough here ( 3. With APS RETRY, the device recovered at once ( The window looks right to me, but on Ember it may also need the Default Response sent with RETRY. I've opened #1957 for that part. herdsman_towel_excerpt.txt |

fix: time-limit default response de-duplication
Fixes #1873
What
sendDefaultResponseskips the response when the incoming frame's ZCL transaction sequencenumber equals
_lastDefaultResponseSequenceNumber. The check has no time limit, so thesequence number is treated as "already answered" forever. This PR limits it to 1 s.
Why
The check exists because the same frame is sometimes handed up twice. Those duplicates arrive
back to back (3 ms apart, measured in #1873), so a 1 s window keeps that protection fully
intact — the existing
Send default response once to frame received twicetest passesunchanged.
What the permanent form breaks:
gets exactly one default response, ever. Every later copy is silently dropped, the device
never sees an answer and retransmits at 3–5 frames/s indefinitely.
cleared in
resetTransient, which runs on device announce and on join(controller.ts#L723).
A router never re-announces, so only a Zigbee2MQTT restart or a power cycle of the device
gets it out.
with
BUFFER_FULLand the network goes down (Default response de-duplication by TSN can deadlock mains-powered devices that retransmit after a lost defaultRsp (network flood, BUFFER_FULL) #1873, [TS011F / _TZ3210_5ct6e7ye] Malformed array report on cluster 0xE000 causes infinite retransmission loop zigbee2mqtt#33174).It is a device firmware bug, but the cost of the two failure modes is not symmetric: a
redundant default response is dropped by the sender, a missing one deadlocks the device.
Field data
Tuya TS011F socket
_TZ3210_cehuw1lw(TS011F_plug_1), Zigbee2MQTT 2.14.2, ember / EmberZNet7.4.4:
0x0B04haElectricalMeasurement, commandreport(0x0A), byte-identicalpayload, ZCL transaction sequence number fixed at 182 while the APS sequence kept incrementing,
disableDefaultResponse: false. So these are new transmissions, not stack-level retries.network went from ~700 to ~115 publishes per minute once it stopped.
/configureandconfigure_reportingdo not get the device out of it, which fits themechanism: the device's own
readRsp/configReportRspcarrydisableDefaultResponse: 1,so those frames produce no default response and the stored sequence number never changes.
never re-announces — stopped the flood immediately, every time. It came back later on its own.
Four other users in #1873 report the direct form of the recovery on Z-Stack and ember, on
mains- and battery-powered devices (
_TZE204_laokfqwu,_TZE284_o3x45p96,_TZE284_locansqn):sending one more default response for the repeated sequence number releases the device within a
second, after hours or days of looping.
Change
DEFAULT_RESPONSE_DUPLICATE_WINDOW = 1000.#privatefield so it stays out of the database entry and out of the device clones the tests compare.
out less than 1 s ago.
Test
New test in the existing block: the same frame, repeated 1 s later, is answered a second time.
It fails on
master(expected "defaultResponse" to be called 2 times, but got 1 times) andpasses with this change. Full suite green, coverage still 100 %.
🤖 Generated with Claude Code