Problem
Synchronous checkpointer and store provider singletons are lazily initialized without locks. Concurrent access can race and create multiple instances or observe partially initialized/reset state.
Impact
In multithreaded gateway/runtime contexts, callers can get inconsistent singleton instances or leak resources during concurrent initialization/reset.
Suggested Fix
Protect singleton initialization and reset with a lock and double-check pattern. Ensure reset and initialization cannot interleave.
Tests
- Concurrently call the sync checkpointer provider from multiple threads and verify a single instance is created.
- Repeat for the sync store provider.
- Verify reset during initialization is serialized.
References
backend/packages/harness/deerflow/agents/checkpointer/provider.py:103
backend/packages/harness/deerflow/runtime/store/provider.py:103
Problem
Synchronous checkpointer and store provider singletons are lazily initialized without locks. Concurrent access can race and create multiple instances or observe partially initialized/reset state.
Impact
In multithreaded gateway/runtime contexts, callers can get inconsistent singleton instances or leak resources during concurrent initialization/reset.
Suggested Fix
Protect singleton initialization and reset with a lock and double-check pattern. Ensure reset and initialization cannot interleave.
Tests
References
backend/packages/harness/deerflow/agents/checkpointer/provider.py:103backend/packages/harness/deerflow/runtime/store/provider.py:103