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

[BUG] Connection pool grows correctly but never shrinks back

オープン
#445 コメント 0 件 リアクション 1 件 担当者 0 名 GitHub で見る

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

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
38/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
javascript, node.js
領域
database

調査の方向性

まず README.md のプールオプションとライフサイクルのドキュメントを確認し、次に shrink: true を指定して pool.query() と pool.connect() を使い、問題を再現します。ドキュメントに記載された動作が、負荷後に観測された pool.poolSize と一致するか確認します。決定論的な縮小が機能するか、動作とクリーンアップの制御方法が明確に文書化されていれば完了です。

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

説明

Describe your system

  • odbc Package Version: 2.4.8
  • ODBC Driver: IBM DB2 ODBC DRIVER
  • Database Name: DB2
  • Database OS: IBM i (AS/400)
  • Node.js Version: 18.17.1
  • Node.js OS: IBM i

Describe the bug
When using the built-in connection pool with shrink: true, the pool grows beyond initialSize under load but does not shrink back once the load is gone. After all queries have completed and all connections have been released, pool.poolSize remains permanently greater than initialSize, even after a long idle period.

This behavior occurs both when using pool.query() and when explicitly acquiring and releasing connections using pool.connect() and connection.close().

Expected behavior
With shrink: true, once all connections are released and the system becomes idle, the pool should eventually shrink back to initialSize, or at least have a documented, deterministic behavior regarding when or if shrinking occurs.

To Reproduce

  1. Create a pool with the following options:
    const pool = await odbc.pool({
      connectionString,
      initialSize: 2,
      incrementSize: 1,
      maxSize: 20,
      shrink: true
    });
    
    
  2. Run multiple queries in parallel to force the pool to grow
await Promise.all(
Array.from({ length: 10 }, () =>
  pool.query("SELECT 1")
)
);

#or using explicit connections:

const conn = await pool.connect();
await conn.query("SELECT 1");
await conn.close();
  1. Wait until all queries have completed.
  2. Log pool.poolSize

Additional context
Calling connection.close() seems to only return the connection to the pool and does not close the actual database connection. There does not appear to be a documented idle timeout or automatic cleanup of extra connections. As a result, once the pool grows beyond initialSize, it stays larger even when the application is idle. This makes it hard to control the total number of open database connections.

Is this behavior expected by design? If so, it would be helpful to clarify this in the documentation or provide a deterministic way to shrink or evict idle connections.

主要言語
JavaScript
スター
159
フォーク
92
平均マージ
5時間 59分
マージ済み PR(30日)
3

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

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

IBM/node-odbc のほかの issue

IBM/node-odbc の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

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

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