PgLockRegistry exhausts connection pool — one connection per lock #171

Closed
opened 2026-03-02 22:56:52 +00:00 by ash · 0 comments
Owner

Problem

Each Acquire() grabs a dedicated connection from the pool and holds it for the lock lifetime. With many subscriptions/automations, this exhausts the pool.

Real-world: YoYoPass server stuck on startup — 38 subscriptions each holding a connection.

Fix

Single shared connection holds all locks (advisory locks are session-scoped). Refcount tracks held locks. Connection released when last lock released. Close() for clean shutdown.

## Problem Each Acquire() grabs a dedicated connection from the pool and holds it for the lock lifetime. With many subscriptions/automations, this exhausts the pool. Real-world: YoYoPass server stuck on startup — 38 subscriptions each holding a connection. ## Fix Single shared connection holds all locks (advisory locks are session-scoped). Refcount tracks held locks. Connection released when last lock released. Close() for clean shutdown.
ash closed this issue 2026-03-02 23:12:16 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ash/eskit#171
No description provided.