DataConfirm timeout (8 s) for routers can be shorter than Z-Stack's APS retry window
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 52/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- python
- Lĩnh vực
- backend, networking
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Python
- Star
- 172
- Fork
- 49
- Merge trung bình
- 3 phút
- Pull request đã merge (30 ngày)
- 1
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của zigpy/zigpy-znp
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 18/100
-
AF.DataConfirm is matched by ZCL TSN only, so concurrent same-TSN requests to different devices get each other's delivery statusCó thể đã có người làm @puddly đã nhận 20 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
-
`send_packet` no longer rediscovers routes on `APS_NO_ACK`; a stale next hop black-holes devices until restart (since #260)Có thể đã có người làm @zigpy-review-bot đã nhận 25 ngày trước. Đang mởregression
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 38/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
-
discussion documentation
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 28/100
Tất cả issue của zigpy/zigpy-znp
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
volcengine/OpenViking#8432 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Failed chat turns are passed to the follow-up rewrite as completed historyCó thể đã có người làm @hskhyl đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
NVIDIA/auto-ontology#683 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation task
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
-
Implement parse_url and accept http URLs for Pear backendCó thể đã có người làm @muskan-creates352 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
fedora-infra/anitya#2231 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
MarkdownDocSerializer.post_process escapes '\<' to '\<', rendering literal '<' in CommonMarkĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
docling-project/docling-core#1067 ·
Maintainer thường phản hồi trong vòng 3 ngày