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
This commit is contained in:
yangdx 2025-07-13 13:51:48 +08:00
parent 03b40937f7
commit 85cd1178a1

View file

@ -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