Bug description
Currently both connect_timeout and pool_timeout have a default value of 5, see https://www.prisma.io/docs/concepts/database-connectors/postgresql
This unfortunately causes the connect timeout error to not be shown in the default configuration. Instead the user will see the pool timeout error:
PrismaClientInitializationError2 [PrismaClientInitializationError]: Timed out fetching a new connection from the pool. Please consider reducing the number of requests or increasing the `connection_limit` parameter (https://www.prisma.io/docs/concepts/components/prisma-client/connection-management#connection-pool). Current limit: 9.
Only if you either increase the pool_timeout or decrease the connect_timeout the actual, helpful error is shown to the user:
PrismaClientInitializationError2 [PrismaClientInitializationError]: Can't reach database server at `10.255.255.1`:`5433`
I suggest we increase the pool_timeout to 10.
Additionally we could possibly make sure that the pool_timeout never hides the real error. One way would be to disallow identical or smaller values than connect_timeout. Another might be to somehow show the real error anyway.
How to reproduce
const { PrismaClient } = require('@prisma/client')
async function main() {
i = 1
let client
console.log(`start ${i}: no special param`)
client = new PrismaClient({ datasources: { db: { url: `postgresql://postgres:[email protected]:5433/postgres?schema=public`} } })
await client.$connect().catch((e) => {
console.log(`fail ${i}`, e)
})
i++
console.log(`start ${i}: connect_timeout=1`)
client = new PrismaClient({ datasources: { db: { url: `postgresql://postgres:[email protected]:5433/postgres?schema=public&connect_timeout=1`} } })
await client.$connect().catch((e) => {
console.log(`fail ${i}`, e)
})
i++
console.log(`start ${i}: connect_timeout=1&pool_timeout=0`)
client = new PrismaClient({ datasources: { db: { url: `postgresql://postgres:[email protected]:5433/postgres?schema=public&connect_timeout=1&pool_timeout=0`} } })
await client.$connect().catch((e) => {
console.log(`fail ${i}`, e)
})
i++
console.log(`start ${i}: connect_timeout=10`)
client = new PrismaClient({ datasources: { db: { url: `postgresql://postgres:[email protected]:5433/postgres?schema=public&connect_timeout=10`} } })
await client.$connect().catch((e) => {
console.log(`fail ${i}`, e)
})
i++
console.log(`start ${i}: connect_timeout=10&pool_timeout=11`)
client = new PrismaClient({ datasources: { db: { url: `postgresql://postgres:[email protected]:5433/postgres?schema=public&connect_timeout=10&pool_timeout=11`} } })
await client.$connect().catch((e) => {
console.log(`fail ${i}`, e)
})
i++
}
main().finally(async () => {
console.log("done")
})
This will show pool timeouts for case 1 (unexpected) and 4 (kinda expected, as pool timeout default is lower).
Expected behavior
When a connect timeout occurs, I want to see it.
I do not want to see a pool timeout error, when the pool is not really what is causing my problem.
Bug description
Currently both
connect_timeoutandpool_timeouthave a default value of 5, see https://www.prisma.io/docs/concepts/database-connectors/postgresqlThis unfortunately causes the connect timeout error to not be shown in the default configuration. Instead the user will see the pool timeout error:
Only if you either increase the
pool_timeoutor decrease theconnect_timeoutthe actual, helpful error is shown to the user:I suggest we increase the
pool_timeoutto 10.Additionally we could possibly make sure that the
pool_timeoutnever hides the real error. One way would be to disallow identical or smaller values thanconnect_timeout. Another might be to somehow show the real error anyway.How to reproduce
This will show pool timeouts for case 1 (unexpected) and 4 (kinda expected, as pool timeout default is lower).
Expected behavior
When a connect timeout occurs, I want to see it.
I do not want to see a pool timeout error, when the pool is not really what is causing my problem.