Skip to content

An owner that exits while its unlock cannot run leaves the key held with no record #43

Closed

Description

@vheathen

An owner that exits while its unlock cannot run leaves the key held with no record. The owner DOWN handler ignores the result of the unlock and deletes the record, so if the lock connection stalls while idle, the unlock queues behind the pool's ping and is dropped after about 4 to 6 s, and if the stall ends before the 15 s ping timeout, the live session keeps the key, nothing is logged, nothing retries the unlock, and other nodes get :lock_already_taken until that connection ends. If the subscription starts again on the same node, it takes the key once more, so it stays pinned to that node, and later stops on a healthy connection still leave the key held. release/2 keeps a failed unlock and retries it. Same at 19072b4. Low: it needs a stall of several seconds with a subscription stopping during it.

Part of the review of main at 1f9d1f8: #27 (comment)

Activity

  1. yordis commented on Oct 27, 2026

    @yordis
    Member

    Fixed by #61. When an owner exits and its unlock cannot run, the lock server now keeps retrying that unlock until the lock is released, as release/2 already did, instead of dropping the record and leaving the key held.

    Verified with test/advisory_locks_test.exs ("should retry the unlock of an owner that terminates until the lock is released"): it fails against the code before #61 and passes on main.

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