Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Connection terminated due to connection timeout error

オープン
#3,559 コメント 4 件 リアクション 5 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
25/100
issue の種類
バグ
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
azure, javascript, kubernetes, node.js, postgresql

調査の方向性

まず、報告されている TypeORM、pg、Azure Database for PostgreSQL、AKS の構成を確認し、その後、SKU Standard_B4ms と Standard_D4as_v5 の間で動作を比較します。接続タイムアウトのスタックトレースと、Azure Accelerated Networking における差異の可能性を調査します。再現可能な原因と、検証済みの構成または依存関係の修正を特定できれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
JavaScript
スター
13.2k
フォーク
1.4k
平均マージ
6日 15時間
マージ済み PR(30日)
6

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

brianc/node-postgres のほかの issue

brianc/node-postgres の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。