You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
adapter-pg will crash Node process if there is an open connection when the database shuts down #27641
When using adapter-pg, the PrismaPg object internally creates a pg.Pool, but it never subscribes to the error event from this emitter.
Since this is not handled, any error emitted from the pool will crash the entire Node process unless you have also wired up a default global handler like this:
process.on('uncaughtException',(err)=>{});
At a minimum this needs to do some kind of handling and logging in the adapter, but likely should allow the caller to provide a callback handler as well.
Right now without a global handler, pool errors can crash your app.
Severity
🚨 Critical: Data loss, app crash, security issue
Reproduction
Create a project using the driverAdapters and queryCompiler features with a postgres database.
In the configuration of the PrismaPg object, set idleTimeoutMillis to 0 to keep connections alive
Do not set a global handler for the process 'uncaughtException' event
Start your application and make at least on database query
Stop your postgres database
Crash
Expected vs. Actual Behavior
Expected: pg.Pool error events should be handled so they don't cause an uncaught exception from an async callback.
Activity
fix(adapter-pg): subscribe to pool error events to prevent node crash…