sql: grow connection pool lazily instead of opening max on first use - #30636
Draft
robobun wants to merge 3 commits into
Draft
sql: grow connection pool lazily instead of opening max on first use#30636robobun wants to merge 3 commits into
robobun wants to merge 3 commits into
Claude / Claude Code Review
completed
Jun 14, 2026 in 42m 55s
Code review found 2 potential issues
Found 3 candidates, confirmed 2. See review comments for details.
Details
| Severity | Count |
|---|---|
| 🔴 Important | 0 |
| 🟡 Nit | 1 |
| 🟣 Pre-existing | 0 |
| Severity | File:Line | Issue |
|---|---|---|
| 🟡 Nit | src/js/internal/sql/shared.ts:1037-1043 |
Re-entrant #tryGrowPool() via synchronous password() can recurse unboundedly |
Annotations
Check warning on line 1043 in src/js/internal/sql/shared.ts
claude / Claude Code Review
Re-entrant #tryGrowPool() via synchronous password() can recurse unboundedly
`#tryGrowPool()` checks `connections.length >= maxPoolSize` (line 1039) *before* `createPooledConnection()` returns and the slot is pushed (line 1041), but `createPooledConnection()` synchronously invokes a function-valued `password()` — so a `password()` that re-enters `sql.connect()` (the #32198 pattern) while another slot is already pending lands in the new `!all_closed` branch, calls `#tryGrowPool()` again with the same `connections.length`, and recurses unboundedly until `RangeError: Maximu
Loading