#error: connect ETIMEDOUT

2 messages · Page 1 of 1 (latest)

tardy gazelle
#

We have 3 instances (pods) of our nestjs app running in a kubernetes cluster (AKS).
Each customer company has its own dedicated database on a Azure Flexible Server Database for Postgres and there is a central users database (on the same psql server) to connect the users to the right database.
So the typeorm connection is dynamically injected like this:

TypeOrmModule.forRootAsync({
  useClass: TypeOrmConfigService,
  dataSourceFactory: async (options) => await TypeOrmConfigService.getOrCreateDataSource(options as NvdDataSourceOptions),
}),

In the logs of the pods, we see some error: connect ETIMEDOUT [database_ip]:6432 (the port is 6432 because we use azure's pgbouncer). In case of high traffic, these errors occur more often.
Anyone knows how could I troubleshoot this? Is there some limit on the number of database connections that a pod can create?

tardy gazelle
#

Just to close on this, we realised that we were exhausting the connection pool because we had idleTimeoutMillis set to 0 in the connection options...