Message-sent timeouts (3 s / 8 s) are shorter than EmberZNet's APS retry windows
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
- 48/100
Hướng nghiên cứu
Start in bellows/zigbee/application.py at the timeout constants around lines 51–52 and the send handling around lines 1017–1040 and 1156–1160. Read how APS retry and extended-timeout flags affect each send, then choose a host wait that covers the NCP's retry window. Done means timed-out sends no longer fail while the NCP is still delivering frames; the issue notes the analysis has not been reproduced on hardware.
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.
bellows waits a fixed time for EmberZNet's messageSentHandler:
- 8 s for packets with
extended_timeout, which zigpy sets for end devices and for devices without a node descriptor. - 3 s for everything else (
MESSAGE_SEND_TIMEOUT_MAINS/MESSAGE_SEND_TIMEOUT_BATTERY, application.py#L51-L52, used at L1156-L1160).
For sends that use EmberZNet's APS retries (APS_OPTION_RETRY), EmberZNet can legitimately take longer than both. bellows then raises a timeout while the NCP is still delivering the frame, and zigpy's retries queue more copies.
This is based on the prebuilt EmberZNet 9.1 stack library (calculateMsLeft, runEventHandler and sli_zigbee_child_extended_timeout in libzigbee-pro-stack.a), not reproduced on hardware. Older stack versions weren't checked.
Which sends use APS retries
bellows sets APS_OPTION_RETRY on:
- every send zigpy asks to be acknowledged (
TransmitOptions.ACK), e.g. Default Responses, other ZCL responses and the OTA Image Notify; - zigpy's retry attempts, which force route discovery, unless source routing is enabled (application.py#L1017-L1040).
EmberZNet then makes up to three transmissions and waits for the ack after each one.
How long EmberZNet takes
- Normal destinations: 1.6 s per transmission, so up to about 4.8 s. That's longer than the 3 s wait for routers and other non-end devices.
- The coordinator's own sleepy children: 1.6 s plus the indirect transmission timeout (7.68 s, which bellows sets via
CONFIG_INDIRECT_TRANSMISSION_TIMEOUT) per transmission, so up to about 28 s. EmberZNet decides this from its child table, so the extended-timeout flag bellows clears for acked sends doesn't change it. The stack also doesn't re-send while a copy is still queued for the child. - Sleepy devices behind a router, on zigpy's retry attempts of unacked requests: these carry
APS_OPTION_RETRYbut notACK(zigpy keeps a request's ack setting on retries), so bellows keepsextended_timeoutand sets EmberZNet's per-device extended-timeout flag. EmberZNet then also waits up to about 28 s.
What happens
bellows raises TimeoutError after 3 s or 8 s. zigpy's Device.request retries it with a new frame and a new APS counter, while the NCP keeps working on the first one. The destination can therefore receive and act on the same command more than once, and the first frame's late messageSentHandler is dropped.
By default, bellows asks for at least 32 end-device children (and firmware such as NabuCasa's provides them), so the own-child case can cover many devices. Unsolicited acked frames are probably affected most, e.g. the OTA Image Notify; replies to a device's own request likely go out while the device is still polling.
Possible fix
Size the host wait to what the NCP will actually do for that send. For example:
- at least 3 × APS ack timeout for sends with
APS_OPTION_RETRY; - at least 3 × (APS ack timeout + indirect transmission timeout) when the destination is a sleepy child or flagged as extended;
- or simply about 30 s for
extended_timeoutpackets (zigpy-znp uses 30 s for the same case), plus at least about 5 s for the others.
The trade-off is that a send to an unreachable device holds its per-device slot, and one adapter-wide concurrency slot, longer before failing. On the other hand, the NCP already holds its APS unicast entry that long today; bellows just stops waiting for it.
- Ngôn ngữ chính
- Python
- Star
- 221
- Fork
- 104
- Merge trung bình
- 5 ngày 15 giờ
- Pull request đã merge (30 ngày)
- 4
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/bellows
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 15/100
-
Stale NCP source route is never invalidated after SOURCE_ROUTE_FAILURE; end device unreachable until re-pairCó thể đã có người làm @puddly đã nhận 5 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
-
ThreadsafeProxy can still raise `RuntimeError: Event loop is closed` — remaining check-then-use race after #727/#739Có thể đã có người làm @zigpy-review-bot đã nhận 119 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
Tất cả issue của zigpy/bellows
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