Over the last few days I've started to see read ETIMEDOUT errors in production, coming from Postgres (with node-postgres) and I'm having a tough time getting to the source of the problem.
I'm not sure whether the problem is that the database is unable to handle the connection, or whether it's something to do with being unable to acquire a connection from the pool, let alone write to the socket.
I can't recreate the error in development at all (and I can't recreate reliably in production either). Nothing is showing up in the Postgres error logs though.
Here's the pool configuration:
pool: {
max: 50,
min: 0,
idle: 20000,
acquire: 20000
}
As far as I can see, the maximum number of connections we've had concurrently over the last month is 8, so the pool should never have been depleted.
Does Postgres have any kind of configurable query timeout that could be adjusted to make sure that long running queries aren't causing these? Although just for reference, sometimes these are happening for tiny inserts or single row reads.
I'm fairly sure that ETIMEDOUT is a system error, not something thrown by the high level JavaScript drivers. Where is the timeout for the underlying socket defined?