Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught Exception while stopping flows (during deploy) #91

Open
bombjackit opened this issue Dec 21, 2023 · 1 comment
Open

Uncaught Exception while stopping flows (during deploy) #91

bombjackit opened this issue Dec 21, 2023 · 1 comment

Comments

@bombjackit
Copy link

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

  • 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
@bombjackit
Copy link
Author

bombjackit commented Dec 21, 2023

Going deeper, the problem might be this line

if (node.pool) node.pool.close();

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); });
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant