node-red-contrib-mssql-plus
node-red-contrib-mssql-plus copied to clipboard
Uncaught Exception while stopping flows (during deploy)
Current Behavior
Node-red crashed with this dump (while deploying)
20 Dec 16:57:05 - [red] Uncaught Exception:
20 Dec 16:57:05 - [error] ConnectionError: Cannot close a pool while it is connecting
at ConnectionPool._close (S:.node-red\node_modules\mssql\lib\base\connection-pool.js:538:30)
at S:.node-red\node_modules\mssql\lib\base\connection-pool.js:521:12
at new Promise (
Expected Behavior
Node-red must not crash for this unacaught exception
Steps To Reproduce
In my nodered I had a flow that 1 time a second do an update to some tables in sql server (on localhost), maybe this cause the exception (Cannot close a pool while it is connecting) but the problem is that node-red does must not crash with an exception, only report.
Environment
- Node-RED version: 3.1.0
- Node.js version: 18.18.2
- npm version: 10.2.1
- Platform/OS: Windows Server 2012 R2 x64
- node-red-contrib-mssql-plus : 0.12.1
- mssql : 10.0.1
Going deeper, the problem might be this line
https://github.com/bestlong/node-red-contrib-mssql-plus/blob/64f78f4d929179301fd0c7daf4a22a16c2d1661e/src/mssql.js#L335
because node.pool.close() is a promise without catch
maybe a change like this can resolve
if (node.pool) {
const p = node.pool.close();
p.catch(e => { console.error(e); });
}