Skip to content

In-memory backend does not enforce entity locks #368

Open

Description

@andystaples

The in-memory test backend grants entity locks but does not prevent other operations from running while a lock is held. In GetWorkItems, queued entity operations are drained and dispatched whenever the entity is not already in flight; locked_by is not checked. As a result, signals and calls from other orchestrations or clients can execute inside another orchestration's critical section, unlike a real backend, so tests using entity locks can pass despite violating the lock's purpose.

There also appears to be a related orphan-lock cleanup issue: CleanEntityStorage compares ent.locked_by against _instances keys, but locked_by is populated with the lock's criticalSectionId, not the parent orchestration instance ID. This can classify a live lock as orphaned and release it during cleanup.

Could lock ownership/gating be aligned with the real backend semantics, including queueing non-owner operations until unlock? The JavaScript in-memory backend provides a useful reference for lock-owner checks and deferred operations.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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