LightRAG/tests
chengjie 9e3c64df03 fix: critical bugs in workspace lock multiprocess synchronization
Bug 1a - RuntimeError when _registry_guard is None:
- Added explicit check for _registry_guard initialization
- Now raises clear RuntimeError instead of cryptic TypeError
- Helps users understand they need to call initialize_share_data() first

Bug 1b - Workspace async_locks not visible across processes:
- Created new _workspace_async_locks dict for per-process storage
- Fixed issue where async_locks modifications in one process were invisible to others
- This is correct design since asyncio.Lock objects cannot be pickled/shared

Why per-process async_locks:
- asyncio.Lock objects cannot be shared across processes
- Each process needs its own asyncio.Lock instances for coroutine sync
- Cross-process sync is handled by Manager.RLock() in _sync_locks
- Within-process async sync is handled by per-process asyncio.Lock

Testing:
- All 17 existing workspace lock tests pass
- Added 3 new tests specifically for bug verification
- Total 20 tests passing

Impact:
- Fixes potential race conditions in multiprocess scenarios
- Ensures proper synchronization both across and within processes
- Maintains backward compatibility
2025-11-11 00:15:06 +08:00
..
test_aquery_data_endpoint.py Fix conditional logic in streaming response parser of unit test 2025-09-27 21:43:46 +08:00
test_curl_aquery_data.sh Fix linting 2025-10-06 04:57:11 +08:00
test_graph_storage.py Initialize shared storage for all graph storage types in graph unit test 2025-11-06 19:24:12 +08:00
test_lightrag_ollama_chat.py clean comments and unused libs 2025-02-18 21:12:06 +01:00
test_postgres_retry_integration.py Refactor PostgreSQL retry config to use centralized configuration 2025-10-10 03:44:13 +08:00
test_workspace_lock_bugfixes.py fix: critical bugs in workspace lock multiprocess synchronization 2025-11-11 00:15:06 +08:00
test_workspace_locks.py style: apply code formatting to pass pre-commit checks 2025-11-11 00:10:54 +08:00