Skip to content

sessions.json has no cross-process locking — concurrent instances can still interleave writes #55

Description

@TMHSDigital

#54 made persist() merge with the on-disk registry before writing (and write atomically via tmp+rename), which stops one server instance from wholesale clobbering another's records. But there is still no cross-process lock: two instances that read-merge-write at the same moment can interleave, and the last writer's snapshot of a record wins.

Impact today is small (worst case: a status/duration update from one instance is briefly overwritten by another's stale copy), but a proper fix would be one of:

  • a lockfile around read-merge-write (e.g. proper-lockfile or an O_EXCL sentinel with retry), or
  • per-instance registry files (sessions-<pid>.json) merged on read, so no two processes ever write the same file.

See SessionStore.persist() in src/utils/sessions.ts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions