From 70d6447ac1009eac0680a4e448eaaa449f07812e Mon Sep 17 00:00:00 2001 From: LING YE Date: Thu, 18 Jan 2024 11:46:19 +0800 Subject: [PATCH 1/2] fix: The removeIdleTimeoutConnectionsTimer did not clean up when the pool was closed. --- lib/pool.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/pool.js b/lib/pool.js index db54a7ab76..1b4993ff1a 100644 --- a/lib/pool.js +++ b/lib/pool.js @@ -100,6 +100,7 @@ class Pool extends EventEmitter { end(cb) { this._closed = true; + clearTimeout(this._removeIdleTimeoutConnectionsTimer); if (typeof cb !== 'function') { cb = function(err) { if (err) { From a0fe8229c1a562b81cf11d87bb4e235ccdbf1fcf Mon Sep 17 00:00:00 2001 From: LING YE Date: Thu, 18 Jan 2024 14:30:21 +0800 Subject: [PATCH 2/2] test: when the pool is closed, it should clean up timers. --- test/integration/test-pool-release-idle-connection.js | 1 - 1 file changed, 1 deletion(-) diff --git a/test/integration/test-pool-release-idle-connection.js b/test/integration/test-pool-release-idle-connection.js index 44da790faa..24644e6bb0 100644 --- a/test/integration/test-pool-release-idle-connection.js +++ b/test/integration/test-pool-release-idle-connection.js @@ -38,7 +38,6 @@ pool.getConnection((err1, connection1) => { connection4.release(); connection4.destroy(); pool.end(); - setTimeout(() => process.exit(0), 1000); }); }, 7000); });