Repository navigation
fix(proxy): stop queued registry read-throughs spending the resync budget - #44277
Merged
Merged
Conversation
…dget RegistryReadThrough.attempt serializes misses behind one lock, but every request that was queued behind the first one still spent a unit of the 20-per-5s resync budget and re-ran the DB resync, even though the first request had already loaded the object. A burst of more than 20 requests for a model created on another worker therefore exhausted the budget and the rest got 400 "Invalid model name". attempt now checks whether the key is already loaded once it holds the lock and returns early without touching the budget. Models check the router's model names and deployment ids, guardrails and agents reuse their existing registry lookups.
Contributor
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…ch registry's loaded check The queued-requests test now holds the first resync on an asyncio.Event instead of a timed sleep and records calls in a recorder with tuple and frozenset state. New tests show the model, guardrail and agent read-throughs each answer an object that is already loaded without reading the database, so rewiring any registry's loaded check now fails a test
Contributor
Author
…d type the agent registry fixture
Contributor
Author
yucheng-berri
approved these changes
Oct 3, 2026
4 of 6 tasks
yuneng-berri
added a commit
that referenced
this pull request
Oct 3, 2026
* fix(proxy): stop queued registry read-throughs spending the resync budget (#44277) * fix(proxy): stop queued registry read-throughs spending the resync budget RegistryReadThrough.attempt serializes misses behind one lock, but every request that was queued behind the first one still spent a unit of the 20-per-5s resync budget and re-ran the DB resync, even though the first request had already loaded the object. A burst of more than 20 requests for a model created on another worker therefore exhausted the budget and the rest got 400 "Invalid model name". attempt now checks whether the key is already loaded once it holds the lock and returns early without touching the budget. Models check the router's model names and deployment ids, guardrails and agents reuse their existing registry lookups. * test(proxy): gate the queued read-through test on events and cover each registry's loaded check The queued-requests test now holds the first resync on an asyncio.Event instead of a timed sleep and records calls in a recorder with tuple and frozenset state. New tests show the model, guardrail and agent read-throughs each answer an object that is already loaded without reading the database, so rewiring any registry's loaded check now fails a test * test(proxy): keep the queued read-through recorder inside its test and type the agent registry fixture (cherry picked from commit b877a38) * chore(deps): bump oauthlib to 4.0.0
8 tasks done
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.
TLDR
Problem this solves:
Invalid model nameHow it solves it:
User Flow
Before: right after an admin adds a model, part of a client burst for it fails with 400
openai/gpt-4o-miniand get 200Invalid model name passed in model=<name>, the rest 200After: the same burst succeeds in full
openai/gpt-4o-miniand get 200Relevant issues
Introduced by #36263, and it started showing up in CI (
tests/integration/observability/test_azure_storage_chaos.py::test_slow_sink_lands_every_id_once_without_deadlock) after #43082Affected release
Regression since v1.99.0-rc.1
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
uv run pytest tests/unit/<your_test_file>.py -v. Leave the suites (make test-unit-*,make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more@greptileaito re-request a review after pushing changes)Delays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).
Screenshots / Proof of Fix
Shared setup: a fresh local
postgres:16container on port 55440, no Redis, and thisconfig.yaml, so the second worker only learns about the new model through the read-through. Each checkout sits outside the main repo so no parent.envgets loaded, and every boot log only mentions Redis in thelogin_throttle.py"Redis is not configured" warningEach run starts a fresh proxy (steps 1 and 2), since a warm proxy finishes the first resync too fast for enough requests to queue behind it. Both sides ran the exact same steps: three runs with 60 concurrent requests and three with 150, each with a new model name
Before (b94eaa6)
Start the proxy with 2 workers from a checkout of that commit
Add the model
Immediately fire 60 concurrent chat completions for it and tally the status codes
Check the proxy log
Repeating steps 1 to 4 on a fresh proxy each time gives
After (1a012fe)
Start the proxy with 2 workers from a checkout of that commit, same command on port 4222
Add the model, same as Before with
MODEL=nra2Immediately fire 60 concurrent chat completions for it, same as Before
Check the proxy log
Repeating steps 1 to 4 on a fresh proxy each time gives
Type
🐛 Bug Fix
Caveats (if any)
Low