Skip to content

test(integration): partition wedged burst publishes by burst-only evidence and kill a real uvicorn worker - #46029

Open
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
litellm_wedged_publish_partition_3e9b
Open

devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
litellm_wedged_publish_partition_3e9b

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

TLDR

Problem this solves:

  • The wedged-redis test flakes when a parked burst publish lands after recovery
  • Its log check also counted earlier bulk-update failures as burst timeouts
  • The worker-kill step never killed a uvicorn worker

How it solves it:

  • Timed-out keys come only from log lines written after the burst started
  • Parked burst keys must land exactly once, timed-out ones never
  • The victim is a logged Started server process [pid] child, asserted gone after SIGKILL

Relevant issues

CircleCI job 2258028 (integration-management-replica, SHA 102619d) failed with "wedged publishes unexpectedly landed after recovery: ['..._u20']". In that run's proxy log u20 failed during the bulk phase but not during the burst, so its burst publish was parked behind the 16-slot semaphore and correctly delivered after SIGCONT

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have added meaningful tests
  • The handful of test files covering my change pass locally, e.g. 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
  • My PR passes all required CI/CD checks (e.g., lint, schema.d.ts sync check, etc.)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • I have received a Greptile Confidence Score of at least 4/5 before requesting a maintainer review (Greptile reviews automatically once the PR is opened; only comment @greptileai to 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

This PR only changes an integration test, so the proof is the test itself run against a real proxy (2 workers), real Postgres and a real owned Redis, plus two product mutations that must turn it red. Every run used the local copy of .circleci/scripts/run_integration.sh with the group's egress guard stripped and Redis 7.2.16 first on PATH

PATH="/home/ubuntu/scratch/redis7:$PATH" bash /home/ubuntu/scratch/run_integration_local.sh management replica

Before (102619d)

  1. The CircleCI failure above. Locally the same test passed once on main (1 passed in 140.75s), and its proxy log showed both workers from Started server process [5622] and [5623] still alive at the final SIGTERM with no Child process [...] died line, so the old _worker_pid killed something other than a worker

After (c3add1f)

Five runs in a row

  1. Command
for i in {1..5}; do
  PATH="/home/ubuntu/scratch/redis7:$PATH" bash /home/ubuntu/scratch/run_integration_local.sh management replica 2>&1 | tee "/home/ubuntu/scratch/wedged_runs/run-$i.txt"
  test ${PIPESTATUS[0]} -eq 0 || break
done
  1. Output, with the burst_partition and transport_error_count properties from each run's junit
Run pytest Victim pid Timed out Parked, delivered once each Transport errors
1 1 passed in 135.57s (0:02:15) 27775 u5, u20 u10, u15, u25 0
2 1 passed in 129.96s (0:02:09) 29173 u5 u10, u15, u20, u25 0
3 1 passed in 129.11s (0:02:09) 30540 u5, u25 u10, u15, u20 0
4 1 passed in 139.84s (0:02:19) 31949 u10 u5, u15, u20, u25 0
5 1 passed in 131.01s (0:02:11) 33294 u15, u25 u5, u10, u20 0

In every run the proxy log shows Child process [<victim>] died followed by a new Started server process, and the burst still returned 200s within the unchanged timing budgets

Mutation A, re-publish a timed-out publish after recovery

  1. Temporary change in litellm/proxy/common_utils/auth_cache_invalidation_pubsub.py, reverted before pushing
     except Exception as e:  # noqa: BLE001  # best-effort publish; mutations must never fail on redis errors
         verbose_proxy_logger.warning("auth cache invalidation publish for %s failed: %s", cache_key, e)
+        while True:
+            try:
+                await pubsub_capable_client(redis_cache).publish(auth_cache_invalidation_channel(redis_cache), message)
+                return
+            except Exception:
+                await asyncio.sleep(0.5)
  1. Same runner command, red at test_user_updates_wedged_coordination_redis.py:350
E   AssertionError: timed-out publishes unexpectedly landed after recovery: ['integration_wedged_redis_3f5b984d5c7e4145a049d03f05daaff0_u5']
======================== 1 failed in 130.27s (0:02:10) =========================

Mutation B, drop parked publishes instead of delivering them

  1. Temporary change in the same function, reverted before pushing
         client: Final = pubsub_capable_client(redis_cache)
+        if _in_flight_publishes.locked():
+            return
         async with _in_flight_publishes:
  1. Same runner command, red at test_user_updates_wedged_coordination_redis.py:321, the poll that waits for every wedged burst key to either time out after the burst offset or land after recovery
E   AssertionError: State did not converge: ('Prisma schema loaded from schema.prisma\n...
======================== 1 failed in 171.26s (0:02:51) =========================

Type

✅ Test

Caveats (if any)

Medium

  • The SIGKILL now happens just before the burst, not mid-burst
    • With a real worker killed mid-burst, one of three runs dropped 8 in-flight requests, over the unchanged <= 3 transport-error bound
    • The old mid-burst kill never hit a worker, so that path had no real coverage before either
    • The test now waits for the victim to be gone, then proves the survivor serves the burst promptly
  • A new 30s poll before SIGCONT waits for the first burst timeout line
    • Without it the wedge sometimes ended before any publish timed out, leaving timed_out empty in two of three runs
  • A barrier publish on u30 (10s poll) runs before reading recovered messages, so a late redelivery cannot slip past

Low

  • scripts/test_quality_gate.py could not fetch its default base locally, so it ran with --base origin/main (passed)

@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@codecov

codecov Bot commented Oct 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@mateo-berri

Copy link
Copy Markdown
Contributor

#47108 is merged and changes this same wedged Redis test, so this PR now conflicts with main and needs main merged in before review

@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

❌ Cannot revive Devin session - the session is too old. Please start a new session instead.

View session

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants