Skip to content

Session registry: lock gives up and writes unlocked after 2 s (flaky test), and reads never refresh from disk #235

Closed

Description

@TMHSDigital

Why it matters

Under load, the cross-process lock deliberately drops mutual exclusion and records are lost. The test suite already catches this intermittently. Separately, every instance only sees its own writes, so list_sessions/get_session/read_events/resources are stale for recordings made by another instance, and a stale copy can overwrite newer fields.

Evidence

Suggested approach

  • Never write unlocked: wait longer with backoff, then fail the write with a clear error (or queue and retry). Break stale locks only by verified dead pid + age.
  • Re-read the registry (under the lock, or after an mtime check) in get()/list(), and merge field by field on update instead of replacing whole records.
  • Give the cross-process test realistic timing slack.

Done when

50 consecutive runs of the cross-process test pass. A test shows instance A sees a session started by instance B without writing first.

Activity

  1. added
    bug
    testing
    effort: medium
    on Oct 25, 2026
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

    bugeffort: mediumpriority: mediumtesting

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions