Skip to content

Abort reserve() and begin() leases with an AbortSignal #10

Open

Description

@okomarov

On serverless platforms that keep an instance warm between invocations (for example Vercel fluid compute), an invocation can end or be cut off in the middle of sql.reserve() or sql.begin(). The lease is never released, so the connection stays reserved for the life of the instance and the pool can run out of connections.

Proposal

  • Accept an AbortSignal on reserve() and begin(). Aborting discards the lease: the connection is terminated, so the server rolls back any open transaction, and later statements on the handle reject with a new LEASE_ABORTED code.
  • In the lease code this is settle(l, Lease.Discarded).

Open questions

Tests

  • An aborted reserve() and an aborted begin() free their connection, roll back, and the pool keeps serving.

Also turns the porsager#893 self-deadlock (the outer sql used inside begin() while every connection is held) into an error.

Activity

  1. added
    enhancement
    on Oct 9, 2026
  2. moved this to Next in Roadmapon Oct 15, 2026
  3. added
    area: timeouts
    area: transactions
    upstream
    on Oct 16, 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

    area: timeoutsarea: transactionsenhancementupstream

    Type

    No type

    Projects

    • Status
      Next

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions