set_extended_timeout: clearing for acked sends only affects devices behind routers, no-op round-trips for own children, address table eviction
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 35/100
Línea de trabajo
Read the linked analysis in zigpy/zigpy#1891 and inspect bellows/ezsp/v4/__init__.py and bellows/zigbee/application.py at the cited lines, along with the XNCP combined send. Compare the host and firmware behavior for child devices, routed sleepy devices, and address table entries. Done means choosing and validating a consistent change across the host and combined send paths while accounting for the stated retry-time trade-off.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Found while investigating zigpy/zigpy#1891. The full analysis is in https://github.com/zigpy/zigpy/issues/1891#issuecomment-5925240976. Related: zigpy/bellows#764, zigpy/bellows#668, zigpy/bellows#747 (fixed).
Before every unicast to a known device, bellows checks EmberZNet's per-device extended-timeout flag and writes it if it differs (set_extended_timeout, ezsp/v4/__init__.py#L222-L263, or the XNCP combined send). Since zigpy/bellows#668, it forces the flag off for APS-acked sends (application.py#L1032-L1040). Based on the prebuilt EmberZNet 9.1 stack library (not reproduced on hardware), this has several side effects.
1. The clearing only takes effect where the extension is needed
EmberZNet decides the extension for its own children from its child table (sli_zigbee_child_extended_timeout) and ignores the address table / binding flag. So clearing it before acked sends changes nothing for the coordinator's own children; those still take up to about 28 s (see zigpy/bellows#764).
It only affects sleepy devices behind a router, cutting their retry window from about 28 s to about 5 s. That's shorter than a typical router's 7.68 s hold. So on EmberZNet, an acked frame such as the OTA Image Notify to a sleepy device behind a router can be reported as failed while the router still holds it, whenever the device doesn't poll and ack within about 5 s. That's the zigpy/zigpy#1891 scenario, which was reported there on Z-Stack. Since zigpy/zigpy#1909 (merged; it closed zigpy/zigpy#1891), a failed Image Notify no longer ends the OTA: zigpy waits for the device to query for the image itself, so the update can still complete. The early failure report described here is unchanged.
2. Round-trips that never stick for own children
getExtendedTimeout answers from the child table, so for an own sleepy child it always reports "extended". Every acked send to such a child then runs getExtendedTimeout, lookupNodeIdByEui64 and setExtendedTimeout(False). The last call only updates binding flags and existing address table entries, so it doesn't change the child's retry timing. On firmware without the combined send, that's three serial round-trips before each acked send instead of one.
3. Address table eviction and flag toggling
For an end device the stack doesn't know (not a child or neighbor, no address table entry, and no binding carrying the flag; typically behind a router), the first send that wants the flag set writes an address table entry for it. Until zigpy/bellows#768 that was a random slot (L254-L263); since then bellows fills the application slots in order and, once all are used, replaces them round-robin. By default, bellows configures at least 16 slots.
After that, the flag flips between unacked requests (True) and acked sends (False; responses and other frames that expect no reply, e.g. the Image Notify), and each flip or re-add costs extra serial round-trips. With more such devices than slots, entries keep evicting each other. A device whose entry is evicted while one of zigpy's retry attempts is in flight falls back to 1.6 s retries for the remaining transmissions (unless a binding entry carries the flag).
On a plain unacked send, the flag does nothing, since there's only one transmission. It only matters on zigpy's retry attempts, which force route discovery and are sent with APS_OPTION_RETRY (unless source routing is enabled). See zigpy/bellows#764 for how long those can take.
4. NabuCasa's combined send mirrors this
The XNCP combined send in NabuCasa's 9.1.1.x beta firmware (NabuCasa/silabs-firmware-builder#209, apply_extended_timeout in xncp_common_commands.c) performs the same check-and-set in firmware ("Mirrors the host set_extended_timeout logic"). It saves the serial round-trips but keeps the behavior above.
One difference: it picks the random slot with % sli_zigbee_address_table_size. On the NCP, that size includes the trust center address cache slots (at least two; bellows configures them as a minimum), while the host path only uses the application slots returned by getConfigurationValue(CONFIG_ADDRESS_TABLE_SIZE). A random pick can therefore land in a trust center cache slot, which the stack overwrites round-robin. Any change to the logic here would need a matching firmware change. NabuCasa/silabs-firmware-builder#236 (open) makes that change: the firmware then uses only the application slots (a free one first, else round-robin) and never touches the trust center cache, in line with zigpy/bellows#768 on the host side.
Possible direction
- Honour zigpy's
extended_timeoutfor acked sends to end devices again, and size the host wait to match (see zigpy/bellows#764). - Skip the call entirely for the coordinator's own children, e.g. based on the child table.
- Only create address table entries when the extension will actually be used.
The trade-off: acked sends to an unreachable sleepy device behind a router would take about 28 s to fail instead of about 5 s, which is what zigpy/bellows#668 wanted to avoid. (Retry attempts of unacked requests already keep the extension today.)
- Lenguaje dominante
- Python
- Estrellas
- 221
- Forks
- 104
- Merge medio
- 5 d 15 h
- PR fusionados (30 d)
- 4
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de zigpy/bellows
-
Dificultad 4/5 3-5 días Aptitud para principiantes 15/100
-
Stale NCP source route is never invalidated after SOURCE_ROUTE_FAILURE; end device unreachable until re-pairPosiblemente ocupada @puddly la tomó hace 5 días. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
-
ThreadsafeProxy can still raise `RuntimeError: Event loop is closed` — remaining check-then-use race after #727/#739Posiblemente ocupada @zigpy-review-bot la tomó hace 119 días. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 35/100
Todos los issues de zigpy/bellows
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
volcengine/OpenViking#8432 ·
Los mantenedores suelen responder en 1 día
-
Failed chat turns are passed to the follow-up rewrite as completed historyPosiblemente ocupada @hskhyl la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
NVIDIA/auto-ontology#683 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
documentation task
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
-
Implement parse_url and accept http URLs for Pear backendPosiblemente ocupada @muskan-creates352 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
fedora-infra/anitya#2231 ·
Los mantenedores suelen responder en 2 días
-
MarkdownDocSerializer.post_process escapes '\<' to '\<', rendering literal '<' in CommonMarkAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
docling-project/docling-core#1067 ·
Los mantenedores suelen responder en 3 días