Skip to content

A cancelled pipelined prepared statement that hits a cached-plan error never settles #123

Closed

Description

@okomarov

Found while reproducing #48. A prepared statement queued behind another on the same connection is cancelled before it starts. When the server then answers it with a cached-plan error (for example after a column type change), ReadyForQuery sends it to retry(), which calls execute(), and submit() returns early because the query is cancelled (src/connection.js). Nothing settles it, so the caller waits forever. The statement queued behind it still gets its own result.

Reproduced against real PostgreSQL on every Node job in CI run 38906039086 (cancelled: 'hung'): warm a prepared read, change the column type, run pg_sleep(0.2) with the read and select 1 queued behind it at max: 1, cancel the read during the sleep.

Fix: don't retry a cancelled query; settle it as cancelled.

Activity

  1. added this to the 4.5.0 milestone on Oct 16, 2026
  2. added
    bug
    area: protocol
    on Oct 16, 2026
  3. moved this to In progress in Roadmapon Oct 16, 2026
  4. added a commit that references this issue on Oct 17, 2026
  5. okomarov commented on Oct 17, 2026

    @okomarov
    Author

    Shipped in 4.5.0.

  6. moved this from In progress to Shipped in Roadmapon Oct 17, 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: protocolbug

    Type

    No type

    Projects

    • Status
      Shipped

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions