Repository navigation
fix: wait between /readyz polls when the server answers with a non-200 status - #1250
Open
pcbeingused333 wants to merge 1 commit into
Open
pcbeingused333 wants to merge 1 commit into
pcbeingused333 wants to merge 1 commit into
Conversation
…0 status The 1 second sleep in _run_model sat inside the except httpx.RequestError branch, so a server that answered /readyz with 503 while loading was polled in a tight loop and the timeout budget burned in a few seconds instead of timeout seconds. Move the sleep after the try/except so every failed poll waits. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Author
|
Friendly ping: this is ready for review whenever someone has a moment. Happy to adjust anything. |
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.
Fixes the busy loop in
openllm runwhile the model is loading.Root cause. In
_run_model(src/openllm/local.py) theawait asyncio.sleep(1)between/readyzpolls was indented insideexcept httpx.RequestError. When the server is up but answers/readyzwith a non-200 status (for example 503 while the model loads), no exception is raised, the loop does not sleep and polls immediately. Thefor _ in range(timeout)budget (600 by default) is then used up in seconds, ending in "Model failed to load" long beforetimeoutseconds have passed, and hammering the server meanwhile.Fix. Dedent the sleep one level so every failed poll waits one second, whether the request errored or returned a non-200 status.
Test.
tests/test_local_readyz.pyruns_run_modelwith a simulated/readyzthat always returns 503 and a recordedasyncio.sleep, and asserts one sleep per poll. It fails on main (0 sleeps) and passes with the change.This change was prepared with the help of an AI coding assistant (Claude Code) and submitted by Alex Castillo González.