WHP 的 --timeout 改回開機看門狗,別再五分鐘砍掉常駐 app - #136
Merged
Merged
Conversation
helper 的 vCPU 迴圈把 --timeout(預設 300 秒)當成整段執行的上限,時間到就以 `Guest boot timed out after 300 seconds` 結束。實際效果是 Windows-without-WSL 上任何常駐 app 跑滿五分鐘就無故中止,而錯誤訊息還把人導向「開機失敗」。macOS 的 vz 後端完全沒有對應上限,兩邊行為也不一致。 改成 guest 一進 userspace 就解除看門狗:console 出現 CHEFER_GUEST_IP=(appliance init 交棒前印,走 kmsg,舊 appliance 也有)或 guest-agent 的 [guest-agent] 前綴 輸出即算數。解除判斷放在 HLT 分支——那裡本來就把 console 取出來解析標記,不必在 熱迴圈裡多抓一次字串。逾時訊息也改成講得出是「沒進到 userspace」。 回歸守門:whp-smoke.ps1 改用 20 秒看門狗 + 40 秒停留,若逾時又變回整段上限, 停留期間 VM 就會被砍、腳本失敗。 實機驗證(Windows 11 + WHP):CHEFER_WHP_TIMEOUT=20 下四項檢查全過,服務安然 跑過 40 秒停留。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
--timeout在 helper 裡被當成整段執行的上限,導致 Windows-without-WSL 上任何常駐 app 跑滿 300 秒就無故中止。改成只保護開機,guest 進 userspace 即解除。Why
start在 VM 啟動時記一次、之後不重設,而 vCPU 主迴圈每輪都檢查start.elapsed() > timeout。所以它管的不是「開機有沒有卡住」,而是「這台 VM 總共能活多久」——時間到就以Guest boot timed out after 300 seconds結束,即使 VM 已經好好跑了五分鐘。使用者看到的訊息還會把人導向「開機失敗」的方向。macOS 的 vz 後端沒有任何對應上限(
vz.rs/vz_util.rs/vz-helper/main.swift都沒有),兩個 VM 後端行為不一致。2026-07-28 實機發現:
scripts/whp-smoke.ps1的常駐服務檢查撞到,先前那幾次以為是「卡死」的現象,有一部分其實就是撞到這個逾時。How
解除條件用既有標記,對舊 appliance 也成立:console 出現
CHEFER_GUEST_IP=(appliance init 交棒給 guest-agent 前印,走/dev/kmsg)或 guest-agent 自己的[guest-agent]前綴輸出。判斷放在 HLT 分支——那裡本來就已經把 console 取出來解析CHEFER_GUEST_EXIT,不必為此在熱迴圈裡多抓一次字串。逾時訊息也改寫成講得出是「沒進到 userspace」,並提示CHEFER_WHP_TIMEOUT。Testing
guest_readiness_disarms_the_boot_watchdog(純 kernel 輸出 → 不解除;出現任一標記 → 解除),先寫測試確認失敗再實作cargo test --workspace全過;cargo fmt --check、cargo clippy --workspace --all-targets無告警scripts/whp-smoke.ps1四項全過。腳本改用CHEFER_WHP_TIMEOUT=20+ 40 秒停留當回歸守門——逾時若又變回整段上限,停留期間 VM 就會被砍、腳本失敗Notes
AGENTS.md的 Follow-ups 清空了。