Skip to content

[harness][runtime] Sync checkpointer/store singletons initialize without locks #2549

@hetaoBackend

Description

@hetaoBackend

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions