From be2baee0c15af761668c98ff8cff6e624a52e360 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Wed, 13 May 2026 14:55:59 -0700 Subject: [PATCH] fix deadlock: use RLock for vertex sync refresh lock _handle_reauthentication is called while holding _sync_refresh_lock and re-enters get_access_token which tries to acquire the same lock. threading.Lock is non-reentrant, causing a deadlock. RLock allows same-thread re-entry. Co-Authored-By: Claude Opus 4.6 --- litellm/llms/vertex_ai/vertex_llm_base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litellm/llms/vertex_ai/vertex_llm_base.py b/litellm/llms/vertex_ai/vertex_llm_base.py index caf2022c1db..aa41af3287f 100644 --- a/litellm/llms/vertex_ai/vertex_llm_base.py +++ b/litellm/llms/vertex_ai/vertex_llm_base.py @@ -55,7 +55,7 @@ class VertexBase: # Tracks in-flight background refresh tasks to avoid duplicate refreshes. self._background_refresh_tasks: Dict[tuple, asyncio.Task] = {} # Protects the sync get_access_token refresh path. - self._sync_refresh_lock = threading.Lock() + self._sync_refresh_lock = threading.RLock() def get_vertex_region(self, vertex_region: Optional[str], model: str) -> str: import litellm