Open bombjackit opened 11 months ago
Going deeper, the problem might be this line
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); });
}
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 ()
at ConnectionPool.close (S:.node-red\node_modules\mssql\lib\base\connection-pool.js:520:12)
at node.connectionCleanup (S:.node-red\node_modules\node-red-contrib-mssql-plus\src\mssql.js:335:42)
at node.disconnect (S:.node-red\node_modules\node-red-contrib-mssql-plus\src\mssql.js:459:22)
at mssql. (S:.node-red\node_modules\node-red-contrib-mssql-plus\src\mssql.js:834:21)
at Node.close (S:\AppData\Roaming\npm\node_modules\node-red\node_modules\@node-red\runtime\lib\nodes\Node.js:340:26)
at stopNode (S:\AppData\Roaming\npm\node_modules\node-red\node_modules\@node-red\runtime\lib\flows\Flow.js:745:31)
at Flow.stop (S:\AppData\Roaming\npm\node_modules\node-red\node_modules\@node-red\runtime\lib\flows\Flow.js:387:35)
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