DataConfirm timeout (8 s) for routers can be shorter than Z-Stack's APS retry window
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 52/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- python
- Área
- backend, networking
Línea de trabajo
The timeout is defined in zigbee/application.py at DATA_CONFIRM_TIMEOUT; the issue also says startup already reads NV. Start by tracing that NV read path and how ACK_REQUEST packets wait for AF.DataConfirm. Compare reading the configured retry values with using the 30 s extended timeout. Done means acknowledged sends wait long enough for the configured APS retry window without disrupting other packet paths.
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. Possibly related: zigpy/zigpy-znp#282 (data confirm timeouts to a router during an OTA update; its cause isn't established). Related: zigpy/zigpy-znp#290 (confirms are matched by ZCL TSN only, so confirms can go to the wrong request when same-TSN requests to different devices are in flight; a confirm arriving after its listener timed out here could likewise be taken by another request with the same TSN).
For unicast packets without extended_timeout, zigpy-znp waits 8 s for AF.DataConfirm (DATA_CONFIRM_TIMEOUT, application.py#L36). In practice that's routers: end devices and devices without a node descriptor get the 30 s EXTENDED_DATA_CONFIRM_TIMEOUT, and ZDO requests and broadcasts don't wait for a confirm at all.
Z-Stack's APS retry window
With TI's default configuration, Z-Stack waits APSC_ACK_WAIT_DURATION_POLLED (3000 × 2 ms = 6 s) for the ack after each transmission of an APS-acked frame, for every destination, despite the "polled devices" wording in TI's config comments. I checked this in the prebuilt libZStack_nwk_all.a from SDK 8.30.01.01:
NLDE_DataCnfreschedules every frame that waits for an APS ack usingzgApscAckWaitDurationPolled. OnlyNWK_NO_ROUTEandMAC_TRANSACTION_EXPIREDare reported without waiting.nwk_event_loopreportsZApsNoAckafter the last wait.- With
APS_FRAME_RETRIES= N, that's N transmissions and N waits. The default is 3, so about 18 s.
Effect on zigpy-znp
- Unreachable router: an acked send can take up to about 18 s before Z-Stack reports. zigpy-znp times out first, and zigpy retries while Z-Stack is still retrying.
- Reachable router whose first acks get lost: a success on the third transmission is only confirmed after more than 12 s. zigpy-znp has already timed out, and zigpy sends a new frame with a new APS counter, which the router receives as a duplicate.
Which firmware is affected
Koenkk's CC26xx/CC13xx coordinator firmware (Z-Stack_3.x.0) sets APSC_ACK_WAIT_DURATION_POLLED to 500 (1 s, about 3 s in total), so users of that firmware generally aren't affected. Firmware that keeps TI's default is.
The compiled value isn't necessarily the one in effect, though. Z-Stack writes it to NV item 0x0044 (ZCD_NV_APS_ACK_WAIT_DURATION) only when that item doesn't exist yet, or when it boots with the clear-config startup option (zgInit / zgItemInit). zigpy-znp sets that option when it forms or restores a network (unless form_quickly is used). Otherwise, Z-Stack uses whatever NV holds, so a coordinator flashed without erasing NV, and not re-formed since, can still carry an older value.
Possible fix
Read the ack wait (APS_ACK_WAIT_DURATION, 0x0044) and retry count (APS_FRAME_RETRIES, 0x0043) from NV at startup. zigpy-znp already reads NV there. Then size the confirm timeout for packets with ACK_REQUEST from them.
Simpler: use the 30 s EXTENDED_DATA_CONFIRM_TIMEOUT for packets with ACK_REQUEST. That costs nothing when Z-Stack reports on time; it only lengthens the wait for a confirm that never arrives.
- Lenguaje dominante
- Python
- Estrellas
- 172
- Forks
- 49
- Merge medio
- 3 min
- PR fusionados (30 d)
- 1
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/zigpy-znp
-
Dificultad 4/5 3-5 días Aptitud para principiantes 18/100
-
AF.DataConfirm is matched by ZCL TSN only, so concurrent same-TSN requests to different devices get each other's delivery statusPosiblemente ocupada @puddly la tomó hace 20 días. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 25/100
-
`send_packet` no longer rediscovers routes on `APS_NO_ACK`; a stale next hop black-holes devices until restart (since #260)Posiblemente ocupada @zigpy-review-bot la tomó hace 25 días. Abiertoregression
Dificultad 2/5 1-3 horas Aptitud para principiantes 38/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
-
discussion documentation
Dificultad 4/5 3-5 días Aptitud para principiantes 28/100
Todos los issues de zigpy/zigpy-znp
Issues similares
-
pydanty:is-working
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
pydantic/pydantic-ai#14472 ·
Los mantenedores suelen responder en 1 día
-
bug good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
patrickballard/wheelgap#728 ·
-
bug good first issue
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 1/5 Menos de una hora Aptitud para principiantes 78/100
choras-org/simulation-backend#58 ·
Los mantenedores suelen responder en 1 día
-
backend part-1-modeling testing
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100