From afa904e97a70363393e23e07c4d21ff300f5132e Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Sat, 14 Mar 2026 13:03:13 -0700 Subject: [PATCH] fix: also catch TimeoutExpired in P3018 rollback handler MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit _roll_back_migration uses subprocess.run with timeout=60, so it can raise subprocess.TimeoutExpired in addition to CalledProcessError. Without catching this, a slow database during rollback would escape the handler and bypass _resolve_specific_migration — the same class of bug. Co-Authored-By: Claude Opus 4.6 --- litellm-proxy-extras/litellm_proxy_extras/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litellm-proxy-extras/litellm_proxy_extras/utils.py b/litellm-proxy-extras/litellm_proxy_extras/utils.py index 793e2fefa8e..92cdf476be6 100644 --- a/litellm-proxy-extras/litellm_proxy_extras/utils.py +++ b/litellm-proxy-extras/litellm_proxy_extras/utils.py @@ -521,7 +521,7 @@ class ProxyExtrasDBManager: ProxyExtrasDBManager._roll_back_migration( migration_name ) - except subprocess.CalledProcessError as rollback_err: + except (subprocess.CalledProcessError, subprocess.TimeoutExpired) as rollback_err: logger.warning( f"Failed to roll back migration {migration_name}: {rollback_err}. " f"It may already be in a rolled-back state."