mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-28 00:00:38 +00:00
* fix(proxy): retry failed audit log writes and count the ones that stay lost A failed audit insert after a management change was logged and dropped, so a 200 could leave no audit row and no signal. Temporary database failures now retry in a tracked background task, and a write that still fails names its rows in the log and increments the callback failure metric once per row * fix(proxy): log each lost audit row on its own bounded line * fix(proxy): run audit log retries one at a time per worker Retries share the Rust connection pool with key auth reads, so a slow failing insert could hold every connection. Each worker now runs one retry attempt at a time, and a write stops retrying 30 seconds after its first failure * fix(audit): bound audit retries by their time limit and try once more at shutdown A retry that hung on the database held the per-worker retry lock past its 30 second limit, so the retries queued behind it were neither stored nor counted. The limit now covers both waiting for the lock and the attempt, and a spent limit no longer sleeps out the remaining delays. When the shutdown drain starts, a waiting retry skips its delay and makes one last attempt, so SIGTERM no longer waits out a retry delay before the entry is stored or counted * fix(proxy): log the first failed audit write and retry it for the full 30 seconds A failed first attempt now logs a warning before its background retry, so a short failure or a killed worker still leaves a trace. The retry delays now reach 28.5 seconds, so a fast lasting failure is retried across the whole window instead of 7.5 seconds. A retry error naming the audit primary key counts as already stored only when the database rejected it as data. * fix(proxy): let an audit retry still running at its time limit finish The 30 second retry limit cancelled an insert that was still running on the database. Cancelling the native insert mid-flight left the worker's database pool stuck, so later audit writes hung and every key request waited 10 seconds for its user lookup until the proxy restarted. The limit now bounds only the wait for a retry's turn. An attempt that is still running when the limit passes is counted as lost at once and finishes in a tracked background task, which releases the retry lock when it returns. * test(proxy): drive the still-running audit retry test with a skippable loop clock The test now stalls the retry on an event and moves the loop clock past the retry limit, so it no longer depends on real sleeps finishing in order. It also drops an unused time import. * fix(proxy): let a failed audit retry answer for the retries waiting behind it During a slow database failure each worker ran its queued audit retries back to back, so one pool connection stayed busy for the whole 30 s window and a shutdown drain ran out of time with retries still queued, dropping them without logging or counting them. A retry that waited for its turn while the attempt ahead of it failed now counts that failure as its own and moves on to its next delay, so a worker makes one attempt per turn while the database keeps failing and every queued retry is counted soon after shutdown starts. A retry still running at its 30 s limit that stores its row afterwards now logs that it was saved after being counted. The concurrent retries test now expects 5 attempts instead of 9, because the retries queued behind a failed attempt no longer each try the database * fix(proxy): share a failed audit retry only when the database is unavailable A retry that waited for its turn while the attempt ahead of it failed took that failure as its own for any retryable error. A batch whose retry timed out then made smaller writes queued behind it skip inserts that would have worked, and on their last turn or at shutdown those entries were counted as lost without a try of their own. Only a failure that marks the database unavailable, a lost connection or no free connection, now stands in for the retries waiting behind it. Any other failure leaves each waiting retry its own attempt. --------- Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com> |
||
|---|---|---|
| .. | ||
| __init__.py | ||
| team_metadata_validator_impls.py | ||
| test_access_group_key_sync.py | ||
| test_access_group_model_sync.py | ||
| test_access_group_team_sync.py | ||
| test_app_groups.py | ||
| test_apps.py | ||
| test_audit_log_callbacks.py | ||
| test_audit_logs_proxy.py | ||
| test_auto_router_availability.py | ||
| test_auto_router_permissions.py | ||
| test_bulk_user_creation.py | ||
| test_bulk_user_deletion.py | ||
| test_customer_budget_usage.py | ||
| test_customer_hierarchy.py | ||
| test_management_helpers_utils.py | ||
| test_mcp_auth_profile_grants.py | ||
| test_object_permission_utils.py | ||
| test_resource_display_names.py | ||
| test_team_list_sorting.py | ||
| test_team_member_permission_checks.py | ||
| test_team_metadata_validation.py | ||
| test_team_roster_sync.py | ||
| test_user_list_sorting.py | ||