Skip to content

chore(database): remove the oven-sh/bun#42804 broken-pool detector, fixed in Bun 1.4.4 #2979

Closed

Description

@glennmichael123

What

Bun 1.4.4 fixes oven-sh/bun#42804 (fixed by oven-sh/bun#45304, which ports oven-sh/bun#40913: onconnect never comes after onclose). Stacks' detector for pools broken by that bug is now dead code, and its own tripwire tests say to remove it.

Evidence

On Bun 1.4.4 (the version #2975 moves Stacks to), the two tripwire tests fail exactly as designed:

  • core/database/tests/broken-pool.test.ts
  • core/router/tests/health-broken-pool.test.ts

Both get Postgres's own error, terminating connection due to administrator command, instead of Bun's broken-slot connection must be a PostgresSQLConnection. On Bun 1.4.2 (control) they still reproduce the broken pool, 16/16 passing.

This Bun no longer leaves the pool broken the way oven-sh/bun#42804 describes. ... If this Bun carries the fix, remove the detector: core/database/src/broken-pool.ts, everything that feeds or reads it, and the tests and fixtures built on this server.

Scope

  • core/database/src/broken-pool.ts and its exports (index.ts, runtime.ts)
  • utils.ts: the persistent onQueryError hook on PostgreSQL/MySQL, recordPrimaryDatabaseQueryError, the replica builders' hooks
  • core/router/src/health.ts: the broken-pool 503
  • comments that cite the bug: ensure-database.ts, config/database.ts, docs/guide/query-monitoring.md, the stacks-database skill, the native catalog
  • tests and fixtures built on it: broken-pool.test.ts, health-broken-pool.test.ts, bun-42804-server.ts, broken-pool-detection.ts, and the hook counts pinned by query-logging.test.ts / query-hook-profile.ts

One effect worth stating: production on PostgreSQL/MySQL with query logging off goes back to installing no query hooks at all, the same as SQLite, so bun-query-builder's hook-free fast path applies there again.

Refs #2975

Activity

  1. glennmichael123 commented on Oct 23, 2026

    @glennmichael123
    MemberAuthor

    Removed in 94bf701, pushed alongside the Bun 1.4.4 pin (4ee1225, #2975).

    • Deleted core/database/src/broken-pool.ts, its exports, the PostgreSQL/MySQL onQueryError hook, the replica builders' hooks, the /api/health 503 and the tests and fixtures built on the reproduction server.
    • Production with query logging off installs no query hooks on any driver again. The per-driver hook profile test now pins that; as a control, expecting the old ["onQueryError"] profile fails with installed no hooks.
    • On 1.4.4: database 1360/0, router 434/0 and 441/0. Framework and defaults typecheck clean, with a planted reference to a removed export caught as TS2304.
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