Skip to content

[finding] driver-sql docblocks call non-SQLite pools "roomy (max ≥ 10)" while every factory-built SQL datasource runs at {min:0,max:5} unless it declares a pool #14588

Description

@os-musk

Observation (docblock accuracy — no behaviour change proposed)

Blocked-by: #14648
Unlock-action: re-check PR #14773

Two docblocks in packages/drivers/driver-sql/src/sql-driver.ts reason about the pool size of non-SQLite dialects using knex's own default:

  • :8168 — "…on every non-SQLite dialect, whose roomy pools (max ≥ 10) cannot exhibit the single-connection dead-lock."
  • :5871 — "…on Postgres/MySQL a roomy pool (max=10) lets a fresh connection create the table safely."

knex 3.3.0's Client.poolDefaults() is indeed { min: 2, max: 10 } (node_modules/knex/lib/client.js:229-231). But the runtime never composes a SQL datasource at that default. The only production composition site — buildSqlPool in packages/services/service-datasource/src/default-datasource-driver-factory.ts:626-635 — hands every postgres / mysql datasource an explicit pool of { min: 0, max: 5 } unless the datasource declares its own pool block (a default it preserved on purpose since the pre-#4410 hardcode; pinned by default-datasource-driver-factory.test.ts → "keeps the previous defaults when no pool is declared"). The primary datasource behind OS_DATABASE_URL reaches the driver through that same factory (serve.tsresolveStorageDefinitionDefaultDatasourcePluginDatasourceConnectionService → factory create), with config: { url } and no pool.

Measured (2026-09-02, origin/main @ f60ab90ae, built dist, no live database)

factory.create({ driver: 'postgres', config: { url: 'postgres://u:p@127.0.0.1:1/d' } })
  knex config.pool = {"min":0,"max":5,"createTimeoutMillis":15000}   tarn live min/max = 0/5
factory.create({ driver: 'mysql',    config: { url: 'mysql://u:p@127.0.0.1:1/d' } })
  knex config.pool = {"min":0,"max":5,"createTimeoutMillis":15000}   tarn live min/max = 0/5
factory.create({ driver: 'postgres', config: { url: … }, pool: { min: 3, max: 9 } })
  knex config.pool = {"min":3,"max":9,"createTimeoutMillis":15000}   tarn live min/max = 3/9

Why it is worth a card

The docblocks tell the next reader a pool size the platform does not run at. The headroom argument at :5871 still holds at max: 5, so nothing is broken — but the same misreading (knex's min 2, max 10 as "today's effective default") reached the body and the triage of #14176, where it changed the shape of the remedy. Correcting the two docblocks to name the factory's {min:0,max:5} (and where that number lives) closes the gap at its source.

Related context (not addressed here): #14176 · #5714 lineage (datasource pool honoured by pg/mysql, rejected on sqlite).

Filed unassigned as an observation from the #14176 seat; triage decides the grade.

Generated by Claude Code

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions