Skip to content

A long lock on the subscriptions table makes a node drop every subscription lock #37

Closed

Description

@vheathen

A long lock on the subscriptions table makes a node drop every subscription lock. The claim's UPDATE subscriptions runs on the lock connection with no lock_timeout or statement_timeout. If another session holds or waits for a conflicting table lock for longer than the client timeout (:timeout, 15 s by default), for example ALTER TABLE, LOCK TABLE, VACUUM FULL or a non-concurrent CREATE INDEX, the claim blocks the lock server until that timeout, the lock connection disconnects, and every owner on the node gets lock_released; each subscription then waits its retry interval (60 s by default) before claiming again. A row lock on one subscription does the same only to a claim whose advisory lock is free. The probes used a 1 s client timeout (3 of 3 each); that a table lock catches every node claiming while it lasts follows from the same code path. Before #29 the lock connection did not touch the table. Low: it needs a long table lock, but it takes out the whole node.

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

Activity

  1. yordis commented on Oct 27, 2026

    @yordis
    Member

    Fixed by #59. The claim now bounds how long it waits on a lock on subscriptions, so a long table lock no longer stalls the lock connection past its timeout and drops every lock on the node.

    Verified with test/advisory_locks_test.exs ("should keep every lock on the node while a table lock outlasts a claim"): it fails against the code before #59 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