Abrupt termination after some time running - [error] Error: Connection terminated unexpectedly

Hello. I'm using Node-RED with Docker, trying to run this flow below:

It's a simple flow: get some data from this postgres db, do something, then insert the data into this other postgres db. For the db interactions, I'm using node-red-contrib-postgresql.

This is how the node-red log looks like:

1 Sep 13:25:16 - [info] Node-RED version: v3.0.2
1 Sep 13:25:16 - [info] Node.js version: v16.20.1
1 Sep 13:25:16 - [info] Linux 5.15.90.1-microsoft-standard-WSL2 x64 LE
1 Sep 13:25:17 - [info] Loading palette nodes
1 Sep 13:25:19 - [info] Settings file : /data/settings.js
1 Sep 13:25:19 - [info] Context store : 'default' [module=memory]
1 Sep 13:25:19 - [info] User directory : /data
1 Sep 13:25:19 - [warn] Projects disabled : editorTheme.projects.enabled=false
1 Sep 13:25:19 - [info] Flows file : /data/flows.json
1 Sep 13:25:19 - [info] Server now running at http://127.0.0.1:1880/
1 Sep 13:25:19 - [warn]
(...)
1 Sep 13:25:19 - [info] Starting flows
1 Sep 13:25:19 - [info] Started flows
1 Sep 13:25:47 - [info] Stopping flows
1 Sep 13:25:47 - [info] Stopped flows
1 Sep 13:25:47 - [info] Updated flows
1 Sep 13:25:47 - [info] Starting flows
1 Sep 13:25:47 - [info] Started flows
1 Sep 13:39:40 - [red] Uncaught Exception:
1 Sep 13:39:40 - [error] Error: Connection terminated unexpectedly
at Connection. (/data/node_modules/pg/lib/client.js:132:73)
at Object.onceWrapper (node:events:627:28)
at Connection.emit (node:events:513:28)
at Socket. (/data/node_modules/pg/lib/connection.js:63:12)
at Socket.emit (node:events:513:28)
at TCP. (node:net:301:12)

No exception is caught by the catch:all node in my flow and Node-RED just terminates.

When I try to run the same flow, also with Docker, using my laptop, also with Docker, it works, it keeps running with no problems. For reference, this PC with the error uses Windows 10, my laptop uses Windows 11.

Any help would be very appreciated and I'm here to provide further information. Thanks!

Welcome to the forum @ItsVitor

Are you using the latest versions of all nodes that you have installed? Check in Manage Palette in the dropdown menu.

Which postgres node are you using? node-red-contrib-??? possibly.

Does the working system use the same versions of node-red, nodejs and the installed nodes?

Hello, Colin! Thank you for the response.

Yes. node-red 3.0.2, node-red-contrib-postgresql 0.13.0 and node-red-dashboard (which I'm not currently using in the flow) 3.6.0.

Yes, that's right, node-red-contrib-postgresql.

Yes, running in Docker with node-red 3.0.2 and nodejs 16.20.1. Also same nodes versions.

Something odd happened, though. Trying to uncover where the error was happening in my flow, I:

  1. Removed the inserts from my flow and let it run;
  2. Attested it was running for some time without terminating;
  3. Added back the inserts, goal to test and reproduce the termination;
  4. Attested that the program ran 2,5 days straight with no problems, until I terminated it this morning.

I mean, it is working, but still couldn't figure it out that error and sudden termination.

I think it would be best to submit an issue on the node's github page.
Provide as much information as you can.

I agree. I will do that and link the issue here if anyone else encounters the problem and comes searching.
Thanks, Colin!

Link to the opened issue.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.