Repository navigation
Stop the idle-unload TTL test racing a loaded runner - #8175
Conversation
test_idle_loop_unloads_after_ttl_and_stashes_for_reload drives the idle loop for a fixed 0.2s of wall clock and then asserts one unload happened. That is plenty locally and not always enough on a busy runner, where the loop's first poll can land outside the window. The failure it produces, `assert [] == [1]`, reads as "auto-unload is broken" rather than "the sleep was short", which is how it got blamed on PR 8051. Wait on the condition with a 15s deadline, the same shape the keep-KV test right below already uses for the same reason, then keep polling briefly afterwards so a loop that frees repeatedly is still caught rather than passing because we stopped watching. Verified the "freed once" assertion still fails when the unload stops clearing the slot.
2a8ddf9 to
a06b291
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 83f2b1786e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| break | ||
| # Keep polling briefly after the first unload so a loop that frees repeatedly | ||
| # is still caught, rather than passing because we stopped watching. | ||
| await asyncio.sleep(0.15) |
There was a problem hiding this comment.
Observe follow-up iterations before asserting one unload
On the loaded runners this change targets, the fixed 150 ms observation window can expire before the idle loop completes the two subsequent iterations needed to reveal a repeated-unload regression: after a faulty unload leaves backend.is_loaded true, the first iteration resets activity when seen_model changes and only the following iteration unloads again. Cancelling here can therefore leave unloads == [1] and let the regression pass; coordinate with completed loop iterations or another deterministic signal instead of another short fixed sleep.
Useful? React with 👍 / 👎.
test_idle_loop_unloads_after_ttl_and_stashes_for_reloaddrives the idle-unload loop for a fixed 0.2 s of wall clock and then asserts one unload happened. That is plenty locally and not always enough on a loaded runner, where the loop's first poll can land outside the window.The failure it produces is
assert [] == [1], which reads as "auto-unload is broken" rather than "the sleep was short". That is how it got blamed on #8051, whose change has nothing to do with the idle loop.It now waits on the condition with a 15 s deadline, the same shape the keep-KV test directly below it already uses for the same reason (its comment names the cause: Windows rounds a 10 ms sleep to its ~15.6 ms tick). After the first unload it keeps polling briefly, so a loop that frees repeatedly is still caught rather than passing because we stopped watching.
Verified the "freed once" assertion still fails when the unload stops clearing the slot.
This PR originally also carried fixes for the five tests left red on main by #8050. Those landed in #8182 and #8183 while this was queued, so the branch is now rebased onto them and only the timing fix remains.