Fix pool recycling after close failures#119
Conversation
Keep pool capacity accounting and queued acquires live when closing an expired connection fails. Release as v1.5.4-3.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6ce1656255
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } finally { | ||
| decrementTotal(); | ||
| metadata.delete(connection); |
There was a problem hiding this comment.
Retain connections whose close attempt fails
When closeClientConnection() rejects before closing the resource, as the new tests simulate, this finally block decrements capacity and deletes the only tracked reference while the caller has already removed the connection from idle or leased. The pool then creates a replacement, but pool.close() cannot retry the failed connection, so repeated recycle failures can leak an unbounded number of live DuckDB connections and native resources. Track failed-close connections for later cleanup instead of permanently forgetting them.
Useful? React with 👍 / 👎.
Summary
1.5.4-3Verification
pre-commit run --all-filesbun x prettier --check .bun x tsc --noEmit --project tsconfig.check.jsonCI=1 bun test(638 passed, 8 skipped)bun run buildnpm pack --dry-run --jsonbun run benchCompatibility
No breaking changes are expected.