DataConfirm timeout (8 s) for routers can be shorter than Z-Stack's APS retry window
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 52/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- python
- 領域
- backend, networking
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Python
- スター
- 172
- フォーク
- 49
- 平均マージ
- 3分
- マージ済み PR(30日)
- 1
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
zigpy/zigpy-znp のほかの issue
-
難易度 4/5 3〜5日 初心者へのやさしさ 18/100
-
AF.DataConfirm is matched by ZCL TSN only, so concurrent same-TSN requests to different devices get each other's delivery status対応中かも @puddly が 20 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
-
`send_packet` no longer rediscovers routes on `APS_NO_ACK`; a stale next hop black-holes devices until restart (since #260)対応中かも @zigpy-review-bot が 25 日前に担当しました。 オープンregression
難易度 2/5 1〜3時間 初心者へのやさしさ 38/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
-
discussion documentation
難易度 4/5 3〜5日 初心者へのやさしさ 28/100
zigpy/zigpy-znp の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
vllm-project/vllm#69791 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
BCStudentSoftwareDevTeam/cas#481 ·
メンテナーはふだん 7 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信