fix(db): revert statement_timeout startup options breaking pooled connections (#4284)#4285
fix(db): revert statement_timeout startup options breaking pooled connections (#4284)#4285waleedlatif1 merged 1 commit intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR SummaryMedium Risk Overview Both the realtime socket DB client ( Reviewed by Cursor Bugbot for commit ccb5f1e. Configure here. |
Greptile SummaryThis PR removes the Confidence Score: 5/5Safe to merge — focused, correct revert with no logic changes beyond removing incompatible startup parameters. The change is a minimal, targeted removal of two startup GUC options that were documented as incompatible with connection poolers. Both files are treated consistently. The only remaining finding is a P2 suggestion to re-add timeout protection at the database role level, which does not block merge. No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant App as Application
participant Pool as Connection Pooler (PgBouncer)
participant PG as PostgreSQL
Note over App,PG: Before this PR (broken with pooler)
App->>Pool: Connect + startup options (-c statement_timeout=90000)
Pool--xApp: Error / rejected (pooler cannot forward session GUCs)
Note over App,PG: After this PR (fixed)
App->>Pool: Connect (no startup options)
Pool->>PG: Forward pooled connection
PG-->>Pool: Connection established
Pool-->>App: Connection ready
App->>PG: Query
PG-->>App: Result
Reviews (1): Last reviewed commit: "fix(db): revert statement_timeout startu..." | Re-trigger Greptile |
| const postgresClient = postgres(connectionString, { | ||
| prepare: false, | ||
| idle_timeout: 20, | ||
| connect_timeout: 30, | ||
| max: 30, | ||
| onnotice: () => {}, | ||
| connection: { | ||
| options: '-c statement_timeout=90000 -c idle_in_transaction_session_timeout=90000', | ||
| }, | ||
| }) |
There was a problem hiding this comment.
Runaway query protection now absent at the application layer
With statement_timeout and idle_in_transaction_session_timeout removed, there is no longer a backstop against hung queries or transactions that hold row locks indefinitely. Under connection exhaustion (e.g., a blocked query monopolising all 30 slots), the pool can stall completely. The pooler-incompatibility issue is real and worth fixing, but consider re-applying the same limits at the database role level so they apply regardless of how the client connects:
ALTER ROLE <app_user> SET statement_timeout = '90s';
ALTER ROLE <app_user> SET idle_in_transaction_session_timeout = '90s';This survives connection poolers and requires no client-side configuration.
Summary
Brief description of what this PR does and why.
Fixes #(issue)
Type of Change
Testing
How has this been tested? What should reviewers focus on?
Checklist
Screenshots/Videos