FKITDEV-7973: Sequelize Connection Pool Right-Sizing

Review asks implemented and pushed — awaiting re-review

Both of Pocok256’s open asks (min: 0, drop the evict: 10000 override) landed in commit c89124e29c on 2026-07-27; vuer_oss PR #7852 head is now at that SHA. See Review feedback implemented (2026-07-27).

Still not merged — PR #7852 remains mergeable_state: blocked

The fix is on the branch, not on devel. The two CHANGES_REQUESTED reviews (Pocok256, bencevarga666) still stand — GitHub keeps a PR blocked until the reviewers dismiss/re-approve, and no re-review was requested and no PR comment was posted. Also still open: PR body TÖLTSD KI placeholder, branch ~58 commits behind devel, and Bence László’s measure-first (options.logging + benchmark) guidance. See Net actionable state.

Problem

Default Sequelize pool (max: 100) per process, across 7 Supervisor-managed processes, exhausted PostgreSQL connection slots in dev environments. Error: SequelizeConnectionError: remaining connection slots are reserved for roles with the SUPERUSER attribute, triggered in the “Audit log forward” cron job.

Root Cause

server/db/sequelize.js only set pool.max: 100 with no lifecycle settings (idle, acquire, evict). With 7 processes each potentially opening 100 connections (700 total), and PostgreSQL defaults of 100-200 max_connections, slots got exhausted. Stale connections never released.

Fix Applied (initial, 2026-03-31)

Changed server/db/sequelize.js pool defaults:

  • max: 100max: 10 (7×10=70, safe for PG defaults)
  • Added min: 2 (baseline warm connections) — superseded, now min: 0
  • Added idle: 10000 (release idle connections after 10s)
  • Added acquire: 30000 (30s timeout acquiring from pool)
  • Added evict: 10000 (check for idle connections every 10s) — superseded, override removed

Also fixed shallow Object.assign to deep-merge pool config, so individual pool properties can be overridden via db.options.pool.* in config files without losing other defaults.

Current pool block (after c89124e29c)

pool: { max: 10, min: 0, idle: 10000, acquire: 30000 }

Review feedback (as of 2026-07-27)

For Agents

Source: GitHub API, read 2026-07-27 (view-only at capture time). One review thread, three comments, on server/db/sequelize.js line 27 (the new pool block). Later the same day a fix commit was pushed (Review feedback implemented (2026-07-27)) — but still no PR comments and no re-review requests were written to GitHub.

PR state

FieldValue
PRTechTeamer/vuer_oss #7852
Branch → basefeature/FKITDEV-7973devel
Authorwowjeeez
Stateopen, mergeable_state: blocked
Branch tipwas 7da69cba85 (2026-04-01) → now c89124e29c (2026-07-27); still ~58 commits behind devel
PR bodySummary still contains the TÖLTSD KI placeholder
Reviews2 × CHANGES_REQUESTED standing (Pocok256 2026-05-06, bencevarga666 2026-07-01) + 1 COMMENTED (Pocok256 2026-07-27)

The reviewed hunk is the new pool block:

pool: { max: 10, min: 2, idle: 10000, acquire: 30000, evict: 10000 }

Thread timeline

1. Pocok256 — 2026-05-06 (r3194552888, + CHANGES_REQUESTED)

Pocok256

Szerintem az 1 másodperces default keresés itt teljesen jó. Ha már egy kapcsolatot zárhatónak jelöl nem probléma az ha zárja is minél hamarabb. én személy szerint a max poolt fentebb venném mert anno a 100 is kevés volt.

Gloss: Sequelize’s default 1s evict sweep is fine — i.e. the evict: 10000 override is unwanted; once a connection is marked closable, closing it ASAP is not a problem. Also wanted max raised, because “even 100 was too little back then”.

2. bencevarga666 — 2026-07-01 (r3508314938, + CHANGES_REQUESTED)

bencevarga666

Ne emelgessük a végtelenbe.

  1. 7 process használja ezt… észszerű keretek között tartani elkerülve a szaturációt… talán megfontolandó lenne eltérő konfigot adni ezeknek…
  2. Összhangban kellene lenni az adatbázis max_connections beállításával (attól kevesebb)
  3. A legendárium szerint szerencsésebb kevés transactiont egyszerre (https://wiki.postgresql.org/wiki/Number_Of_Database_Connections)

Gloss: rebuts raising max. Don’t inflate it indefinitely — 7 processes share this, keep it bounded to avoid saturation, consider per-process pool configs, stay below the DB’s max_connections, and the PostgreSQL wiki favours few concurrent connections.

3. Pocok256 — 2026-07-27 (r3657006693, + COMMENTED — newest)

Pocok256

Teljesen jogos de a 7 azért elég strict cli és egyéb is újat nyit. alapesetben egy 10 es érték akkor elegendő. Még annyi hogy a min érték akár 0 is lehetne ha 1 seces lesz az idle connection zárása.

Gloss: concedes the point. Counting only 7 processes understates reality (CLI and other tooling open their own connections), so max: 10 as a default is sufficient. Adds one more ask: min could be 0 if idle connections are closed on a ~1s cadence — consistent with his May stance of keeping the default evict: 1000 rather than the PR’s evict: 10000.

Slight ambiguity in comment 3 — resolved as evict

“ha 1 seces lesz az idle connection zárása” could mean idle: 1000 or keeping Sequelize’s default 1s evict sweep. His 2026-05-06 comment points at the latter, so the 2026-07-27 fix removed the evict override (default 1s sweep restored) and left idle: 10000 untouched. If a reviewer actually meant idle: 1000, that’s a one-line follow-up.

Review feedback implemented (2026-07-27)

For Agents

Commit c89124e29cfaecc3e19dd00def53f26f9302e4a5fix: set pool min to 0 and use default evict interval. Pushed solo-author (Andras Lederer) to feature/FKITDEV-7973; remote ref and PR #7852 head both confirmed at c89124e2. Work done in the kept worktree vuer_oss/.worktrees/feature/FKITDEV-7973.

What changed

Two files — server/db/sequelize.js and its mirror test/lib/utils/db.utils.js (the test harness duplicates the pool config, so both must move together):

  • min: 2min: 0
  • evict: 10000 deleted ⇒ Sequelize’s default 1s evict interval applies
  • max: 10, idle: 10000, acquire: 30000 unchanged
  • acquire lost its trailing comma (it is now the last property — standard-style lint)

Diff is exactly 2 files, +4 / −6.

This satisfies Pocok256 precisely: his 2026-07-27 condition (“min could be 0 if idle connections are closed on a 1s cadence”) plus his May ask (the default 1s check is fine, so the override is unwanted) — the two are one change, since min: 0 is only safe because the sweep is fast.

Verification

CheckResult
node --check on both filesOK
eslint --max-warnings 0 on both filesexit 0 (ESLint 9 flat config via FlatCompat / standard)
git show diff shapeexactly 2 files, +4/−6
Remote ref + PR headboth at c89124e2

Repo gotcha — yarn lint does NOT cover test/

The packaged yarn lint script passes --ignore-pattern "test/*", so a change to test/lib/utils/db.utils.js (or any test file) is invisible to yarn lint and to the CI lint gate. The flat config does define a test/** block, so lint it explicitly:

./node_modules/.bin/eslint server/db/sequelize.js test/lib/utils/db.utils.js

Same ignore pattern that shows up in nusz-devel-update-2026-06-16-lint-merge-fix and ci-github-branch-audit-chronically-red.

Scope of the commit

Code asks only. No re-review requested, no PR comment posted, PR body untouched, no devel catch-up, measure-first guidance not started — see Net actionable state for exactly what remains.

Net actionable state

  • Settled: max: 10 is accepted by both reviewers — do not raise it. (unchanged in c89124e29c)
  • DONE — ask #1: evict: 10000 override dropped, Sequelize’s 1s default restored (c89124e29c).
  • DONE — ask #2: min: 2min: 0 (c89124e29c).
  • Considered, not decided: per-process pool configs (Bence’s point 1) — 7 processes have different profiles; would need db.options.pool.* per supervisor process. Not implemented.
  • Constraint to honour: total pool ceiling must stay below PostgreSQL max_connections. Still satisfied at max: 10.
  • Housekeeping, still open: PR body Summary is still the TÖLTSD KI placeholder; branch is still ~58 commits behind devel (no merge/rebase done).
  • Still unaddressed from the ticket — Bence László’s original guidance (see Bence László’s Review (Assignee)): enable options.logging + options.benchmark, then benchmark and measure before finalizing the numbers. logging is still hardcoded after the config spread in server/db/sequelize.js, so db.options.logging remains non-overridable — this blocks the “measure first” step the assignee asked for.
  • NEXT ACTION — both CHANGES_REQUESTED reviews still stand ⇒ PR remains mergeable_state: blocked. The code asks are now met, but no re-review was requested and no PR comment was posted, so nothing prompts Pocok256 / bencevarga666 to look again. Unblocking needs: ping/re-request both reviewers, fill the PR body, and catch up with devel.

Escalation Path

If pool tuning doesn’t resolve, check for multiple Sequelize instances and consider PgBouncer for connection multiplexing.