Repository navigation
test(e2e): hold failing-request RSS to a loose ceiling over two measured batches - #47170
Merged
Merged
Conversation
…red batches The 48 MB budget on the third batch kept failing on the x86 release gate with no leak behind it. Isolated rc/1.107.0 and v1.105.1 stacks both grew about 60 MB on the third batch with gc-tracked objects flat, and both levelled off to a couple of MB per batch after twenty batches. Measure batches 3-4 against a 200 MB per-worker ceiling instead, which a native leak of 400 KB per failed request still trips. The stored-request size check stays the deterministic catch for the v1.100.0 leak
yuneng-berri
had a problem deploying
to
e2e-changed
October 17, 2026 20:52 — with
GitHub Actions
Error
Contributor
Author
|
bugbot run |
yuneng-berri
enabled auto-merge (squash)
October 17, 2026 21:04
Contributor
|
@litellm-stampbot |
Contributor
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 6dbb65a. Configure here.
yucheng-berri
approved these changes
Oct 17, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
2 of 6 tasks
yuneng-berri
added a commit
that referenced
this pull request
Oct 17, 2026
…#47174) * test(integration): run the bedrock mantle prompt cache and output limit wire tests on their own proxy (#47152) * test(integration): run the bedrock mantle prompt cache and output limit wire tests on their own proxy These two files register deployments with their own model settings on the gateway. They now boot a module-scoped proxy on a scratch database, so their setup cannot affect other tests that share the worker's proxy * test(integration): seed the isolated gateway with the same router settings as the worker gateway (cherry picked from commit 603ba6f) * test(e2e): enable prometheus_system on the redis chaos proxy config (#47160) #46484 moved the litellm_redis_circuit_breaker_* metrics behind service_callback prometheus_system, so the chaos proxy, which only set callbacks prometheus, stopped exposing them and the breaker assertion read 0 (cherry picked from commit 519906e) * fix(tests): wait for every thread of a killed worker before treating it as gone (#47148) WorkerKill returned once the victim's main thread was a zombie. On Linux the process keeps its sockets open until its last thread exits, so a pooled keep-alive connection to the killed worker still looked idle and the next request through it got ECONNRESET. A zombie now counts as gone only once num_threads() is at most 1. Where psutil cannot read threads of a zombie (macOS) it raises ZombieProcess, a NoSuchProcess, so the old behavior holds (cherry picked from commit 0431e75) * test(caching): assert sync cache-hit logging without depending on thread order (#47093) Sync success callbacks run on a thread pool, so the miss and the two hits can reach the logger in any order. Compare counts instead of the list order. (cherry picked from commit 77c2ac1) * test(e2e): hold failing-request RSS to a loose ceiling over two measured batches (#47170) The 48 MB budget on the third batch kept failing on the x86 release gate with no leak behind it. Isolated rc/1.107.0 and v1.105.1 stacks both grew about 60 MB on the third batch with gc-tracked objects flat, and both levelled off to a couple of MB per batch after twenty batches. Measure batches 3-4 against a 200 MB per-worker ceiling instead, which a native leak of 400 KB per failed request still trips. The stored-request size check stays the deterministic catch for the v1.100.0 leak (cherry picked from commit e0514d9) * fix(router): read an application profile's base model from metadata on a cache hit (#47144) * fix(router): read an application profile's base model from metadata on a cache hit The 1h prompt-cache pin check read base_model only from the top level of litellm_params. On a response-cache hit the params it sees carry the base model only under metadata.model_info, so an application-profile ARN resolved to itself and the pin was written for 5 minutes while the wire carried a 1h TTL. Read it through get_base_model_from_metadata, which also checks metadata.model_info * test(router): pin top-level base_model precedence over metadata model_info (cherry picked from commit 1e3641a)
This branch was successfully deployed
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:
How it solves it:
User Flow
Before: a release manager gating rc/1.107.0 sees the memory test go red on every run, with nothing leaking
test_failing_requests_do_not_grow_rss_or_stored_requestfails with "proxy RSS grew 66.2 MB over measured batch 3 ... past the 48 MB budget"After: the same run passes on a healthy proxy and still fails on a gross leak
Affected release
The test has been red on rc/1.107.0 (builds 709, 710 and earlier intermittent fails since build 398). It is a test change only, no product code changes
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 moreDelays 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
Why the 48 MB budget was wrong. Two long isolated runs on the x86 release stack (Buildkite litellm-e2e-pr, only this test, 2 gateway pods, 28 batches of 300 failing requests through the router) compared the rc with the newest stable. A was rc/1.107.0 at 4bf1633 (build 1928). B was v1.105.1 at d665dc1 with the same test code (build 1929). The least-squares RSS slope per batch over batches 18 to 28 was 1.1 and 1.9 MB for A and 1.25 and 1.2 MB for B, and Python gc-tracked object counts were flat in both (A 1.612M to 1.617M, B 1.453M to 1.458M). So the rc levels off the same way the stable does and the early growth is the allocator setting new high-water marks, not a leak. Shorter isolated runs (1923, and 1924 with MALLOC_ARENA_MAX=2, which changed nothing) grew 50 to 62 MB on batch 3 alone
Growth over batches 3 and 4 per pod, the window this PR measures: 1923 61.2 and 51.5 MB, 1924 55.6 and 61.2 MB, 1928 49.3 and 61.3 MB, 1929 12.3 and 37.8 MB. The worst is 61.3 MB, well under 200 MB
Local negative control setup: the rc/1.107.0 image built from 4bf1633, one proxy with Postgres, Redis, a local HTTP sink for the logging callbacks and the CI boot command (
uvicorn litellm.proxy.proxy_server:app, 1 worker). The leaking variant adds a custom callback whoseasync_log_failure_eventappendsos.urandom(400 * 1024)to a module-level list, standing in for memory kept outside the Python object graphBefore (603ba6f)
Healthy rc on the release gate
AssertionError: proxy RSS grew 66.2 MB over measured batch 3 of 300 failing requests ... past the 48 MB budget. Build 710 on main caad4d6 fails the same way at 67.9 MBAfter (6dbb65a)
Healthy rc on the local rig
pytest "router/test_reliability_memory_e2e.py::TestReliabilityMemory::test_failing_requests_do_not_grow_rss_or_stored_request"against the proxy without the leaking callback1 passed in 297.60s, withrss_batch_growth107.0, 74.2, 38.8 and 38.4 MB for batches 1 to 4, so 77.2 MB over the measured windowNative leak on the local rig
AssertionError: proxy RSS grew 248.8 MB over measured batches 3-4 (600 failing requests) after 2 identical warmup batches, past the 200 MB ceilingType
✅ Test
Caveats (if any)
Medium
Low
QA runbook
api_baseis an unreachable address andcooldown_time0, plus a fallback group that refuses the same wayFinal Attestation
Note
Low Risk
Test and e2e config documentation only; no gateway or product runtime changes.
Overview
Relaxes the router failing-request RSS e2e so healthy proxies stop failing the rc gate when x86 allocator high-water marks (~60 MB on batch 3) exceed the old 48 MB single-batch budget, without dropping leak detection.
The test now runs four traffic batches (two warmup, two measured), compares each worker’s settled RSS from after warmup through batches 3–4, and asserts growth stays under
E2E_MEMORY_RSS_CEILING_MB(default 200 MB, renamed fromMEMORY_RSS_BUDGET_MB). The stored spend-log request size cap remains the tight check for the v1.100.0 retry-breadcrumb regression.tests/e2e/AGENTS.mddocuments the ceiling-over-measured-batches behavior.Reviewed by Cursor Bugbot for commit 6dbb65a. Bugbot is set up for automated code reviews on this repo. Configure here.