From 85cd1178a1504d1a31beda6b6a075b23b3cc681b Mon Sep 17 00:00:00 2001 From: yangdx Date: Sun, 13 Jul 2025 13:51:48 +0800 Subject: [PATCH] fix: prevent premature lock cleanup in multiprocess mode - Change cleanup condition from count == 1 to count == 0 to properly remove reused locks from cleanup list - Fix RuntimeError: Attempting to release lock for xxxx more times than it was acquired --- lightrag/kg/shared_storage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lightrag/kg/shared_storage.py b/lightrag/kg/shared_storage.py index 3830c6dd..56fce4e5 100644 --- a/lightrag/kg/shared_storage.py +++ b/lightrag/kg/shared_storage.py @@ -422,7 +422,7 @@ def _get_or_create_shared_raw_mp_lock( f"Shared-Data lock registry for {factory_name} is corrupted for key {key}" ) if ( - count == 1 and combined_key in _lock_cleanup_data + count == 0 and combined_key in _lock_cleanup_data ): # Reusing an key waiting for cleanup, remove it from cleanup list _lock_cleanup_data.pop(combined_key) count += 1