Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Connection terminated due to connection timeout error

Abierto
#3,559 4 comentarios 5 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
25/100
Tipo de issue
Error
Claridad
Necesita aclaración
Estado de actividad
Estancado
Stack tecnológico
azure, javascript, kubernetes, node.js, postgresql

Línea de trabajo

Empieza revisando la configuración reportada de TypeORM, pg, Azure Database for PostgreSQL y AKS, y después compara el comportamiento entre las SKU Standard_B4ms y Standard_D4as_v5. Investiga el stack trace del tiempo de espera de la conexión y la posible diferencia de Azure Accelerated Networking. Se considera terminado cuando se haya identificado una causa reproducible y una corrección verificada de la configuración o de la dependencia.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

We are using NestJS with TypeORM v0.3.25 and pg v8.11.3

Our TypeOrm config is:

const baseOrmConfig: PostgresConnectionOptions & TypeOrmModuleOptions = {
  type: 'postgres',
  host: process.env.DATABASE_HOST ?? 'localhost',
  port: process.env.DATABASE_PORT !== undefined ? Number(process.env.DATABASE_PORT) : 5432,
  username: process.env.DATABASE_USERNAME ?? 'postgres',
  password: process.env.DATABASE_PASSWORD ?? 'password',
  synchronize: false,
  logging: ['error'],
  autoLoadEntities: true,
  ssl: process.env.DATABASE_HOST !== undefined,
  extra: {
    // setting this to 0 to disable auto-disconnect cspell: disable-next-line
    idleTimeoutMillis: 60_000,
    keepAlive: true,
    keepAliveInitialDelayMillis: 60_000,
    max: 10,
    connectionTimeoutMillis: 30_000, // number of milliseconds to wait for connection
  },
};

We host this service on a Azure Kubernetes Service cluster, and are making connections to an Azure Database for PostgreSQL Flexible Server.

Recently, we upgraded our AKS Node SKUs from Standard_B4ms to Standard_D4as_v5, and started seeing a lot of the foll. error:

Error: Connection terminated due to connection timeout 
  at Client.<anonymous> (/usr/src/app/node_modules/pg-pool/index.js:251:17) 
  at Client.patchedClientConnectCallback (/usr/src/app/node_modules/@opentelemetry/instrumentation-pg/build/src/utils.js:309:12) 
  at /usr/src/app/node_modules/@opentelemetry/context-async-hooks/build/src/AbstractAsyncHooksContextManager.js:50:55 
  at AsyncLocalStorage.run (node:internal/async_local_storage/async_hooks:91:14) 
  at SentryContextManager.with (/usr/src/app/node_modules/@opentelemetry/context-async-hooks/build/src/AsyncLocalStorageContextManager.js:33:40) 
  at SentryContextManager.with (/usr/src/app/node_modules/@sentry/opentelemetry/build/cjs/index.js:1430:24) 
  at Client.contextWrapper [as _connectionCallback] (/usr/src/app/node_modules/@opentelemetry/context-async-hooks/build/src/AbstractAsyncHooksContextManager.js:50:32) 
  at Connection.<anonymous> (/usr/src/app/node_modules/pg/lib/client.js:145:18) 
  at Object.onceWrapper (node:events:632:28) 
  at Connection.emit (node:events:518:28) {   [cause]: Error: Connection terminated unexpectedly 
  at Connection.<anonymous> (/usr/src/app/node_modules/pg/lib/client.js:132:73) 
  at Object.onceWrapper (node:events:632:28) 
  at Connection.emit (node:events:518:28) 
  at Socket.<anonymous> (/usr/src/app/node_modules/pg/lib/connection.js:63:12) 
  at Socket.emit (node:events:518:28) 
  at TCP.<anonymous> (node:net:346:12) 
at TCP.callbackTrampoline (node:internal/async_hooks:130:17) } 

We reverted to using the Standard_B4ms SKU and the errors stopped. However, we do need to upgrade our SKUs. We did not have this error on our setup before this.

Any ideas what could be causing this error, and how we could fix this? The only possible explanation we could have found was that it could be related to Azure Accelerated Networking, but have no proof.

Lenguaje dominante
JavaScript
Estrellas
13.2k
Forks
1.4k
Merge medio
6 d 15 h
PR fusionados (30 d)
6

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de brianc/node-postgres

Todos los issues de brianc/node-postgres

Issues similares

Más issues de JavaScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.