From 9dca3f1c85f23d6f363ad27897106aad38c5e015 Mon Sep 17 00:00:00 2001 From: Hermes Local Date: Fri, 24 Apr 2026 10:49:13 +0000 Subject: [PATCH] fix(mem0_oss): fix misrouted last-attempt lock error in _get_memory The else branch for non-lock errors was incorrectly triggered on the final retry attempt of a Qdrant lock error, causing it to log ERROR and raise immediately rather than fall through to the lock-exhausted path. This tripped the circuit breaker during startup when WebUI and gateway processes competed for the lock. Fix: add a comment to skip the else on last lock-error attempt, and downgrade the exhausted-retries log from ERROR to WARNING since lock contention is expected and not a hard failure. --- plugins/memory/mem0_oss/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/memory/mem0_oss/__init__.py b/plugins/memory/mem0_oss/__init__.py index 6d998975d..27a476734 100644 --- a/plugins/memory/mem0_oss/__init__.py +++ b/plugins/memory/mem0_oss/__init__.py @@ -629,11 +629,15 @@ class Mem0OSSMemoryProvider(MemoryProvider): ) _time.sleep(delay) continue + # Last attempt also a lock error — fall through to raise below else: # Non-lock error — fail fast, no retry logger.error("mem0_oss: failed to initialize Memory: %s", exc) raise - logger.error("mem0_oss: failed to initialize Memory after %d attempts: %s", _LOCK_RETRY_ATTEMPTS, last_exc) + logger.warning( + "mem0_oss: Qdrant lock still held after %d attempts — giving up: %s", + _LOCK_RETRY_ATTEMPTS, last_exc, + ) raise last_exc # type: ignore[misc] # -- Circuit breaker helpers -------------------------------------------