set_extended_timeout: clearing for acked sends only affects devices behind routers, no-op round-trips for own children, address table eviction
まだ誰も着手していません。
評価
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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.)
- 主要言語
- Python
- スター
- 221
- フォーク
- 104
- 平均マージ
- 5日 15時間
- マージ済み PR(30日)
- 4
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
zigpy/bellows のほかの issue
-
難易度 4/5 3〜5日 初心者へのやさしさ 15/100
-
Stale NCP source route is never invalidated after SOURCE_ROUTE_FAILURE; end device unreachable until re-pair対応中かも @puddly が 5 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
-
ThreadsafeProxy can still raise `RuntimeError: Event loop is closed` — remaining check-then-use race after #727/#739対応中かも @zigpy-review-bot が 119 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
volcengine/OpenViking#8432 ·
メンテナーはふだん 1 日以内に返信
-
Failed chat turns are passed to the follow-up rewrite as completed history対応中かも @hskhyl が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
NVIDIA/auto-ontology#683 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
documentation task
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
-
Implement parse_url and accept http URLs for Pear backend対応中かも @muskan-creates352 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
fedora-infra/anitya#2231 ·
メンテナーはふだん 2 日以内に返信
-
MarkdownDocSerializer.post_process escapes '\<' to '\<', rendering literal '<' in CommonMarkオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
docling-project/docling-core#1067 ·
メンテナーはふだん 3 日以内に返信