fix(develop): treat 53300 pool exhaustion as transient in render poll (BIT-33549) #329

Merged
spark merged 1 commits from fix/BIT-33549-develop-poll-pool-exhaustion-transient into main 2026-12-04 12:52:10 +00:00
Owner

Summary

The RenderWorker tick handler only checked isPostgresAdminShutdown (57P01) and logged everything else at warn. When a $queryRaw in claimRenders hit PostgreSQL's max_connections limit — Prisma P2010 wrapping SQLSTATE 53300 ("sorry, too many clients already") — every tick paged the error loop.

Changes

  • lib/pg.ts: Extended isPrismaTooManyConnections to also match the P2010/53300 raw-query variant ("sorry, too many clients already", SQLSTATE 53300), in addition to the existing P2037 match.
  • develop/service.ts: Added a branch in the RenderWorker.tick catch block that checks isPrismaTooManyConnections and logs at info ("develop: poll skipped, too many database connections"), letting the next scheduled tick retry once a slot frees.
  • develop/service.test.ts: Added tests for the P2010/53300 variant in isPrismaTooManyConnections and for the tick handler logging it at info instead of warn.

Paperclip-Issue: BIT-33549

## Summary The `RenderWorker` tick handler only checked `isPostgresAdminShutdown` (57P01) and logged everything else at `warn`. When a `$queryRaw` in `claimRenders` hit PostgreSQL's `max_connections` limit — Prisma P2010 wrapping SQLSTATE 53300 ("sorry, too many clients already") — every tick paged the error loop. ## Changes - **`lib/pg.ts`**: Extended `isPrismaTooManyConnections` to also match the P2010/53300 raw-query variant ("sorry, too many clients already", SQLSTATE 53300), in addition to the existing P2037 match. - **`develop/service.ts`**: Added a branch in the `RenderWorker.tick` catch block that checks `isPrismaTooManyConnections` and logs at `info` ("develop: poll skipped, too many database connections"), letting the next scheduled tick retry once a slot frees. - **`develop/service.test.ts`**: Added tests for the P2010/53300 variant in `isPrismaTooManyConnections` and for the tick handler logging it at info instead of warn. Paperclip-Issue: BIT-33549
spark added 1 commit 2026-12-04 12:21:03 +00:00
fix(develop): treat 53300 pool exhaustion as transient in render poll (BIT-33549)
ci / typescript (push) Skipped
ci / rust (push) Skipped
ci / rust (pull_request) Successful in 17m2s
ci / typescript (pull_request) Successful in 21m14s
2d5f898f60
The RenderWorker tick only checked isPostgresAdminShutdown (57P01) and
logged everything else at warn, so a $queryRaw hitting PostgreSQL's
max_connections limit (P2010 wrapping SQLSTATE 53300 'sorry, too many
clients already') paged the error loop on every tick.

Extend isPrismaTooManyConnections to also match the P2010/53300
raw-query variant, and add a branch in the tick handler that logs at
info and lets the next scheduled tick retry once a slot frees — same
pattern as the 57P01 admin-shutdown handling.

Paperclip-Issue: BIT-33549
spark merged commit 243cabb221 into main 2026-12-04 12:52:10 +00:00
Sign in to join this conversation.