# SOLVED : NODE-RED crash while restarting Postgres service in WINDOWS!

**URL:** <https://discourse.nodered.org/t/solved-node-red-crash-while-restarting-postgres-service-in-windows/70777>\
**Category:** General\
**Created:** [17 November 2022 14:37 UTC](https://discourse.nodered.org/t/solved-node-red-crash-while-restarting-postgres-service-in-windows/70777 "2022-11-17T14:37:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Josh](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/josh/32/62208_2.png) [@Josh](https://discourse.nodered.org/u/Josh)\
**Post date:** [17 November 2022 14:37 UTC](https://discourse.nodered.org/t/solved-node-red-crash-while-restarting-postgres-service-in-windows/70777/1 "2022-11-17T14:37:57Z")

</div>

Case: The node "node-red-contrib-postgresql" when deployed in flow works smooth. But when the postgres service is stopped for any reasons. The node causes the whole nodered to crash, resulting in this error :

> error: terminating connection due to administrator command\n at Parser.parseErrorMessage

Error Scenario: This error occurs when the connection pool inside the postgres node isn't written to handle error.

Fix: Open postgresql.js from the node-red-contrib-postgresql folder from node\_modules and copy paste the below code to handle the connection pool error.

```auto
this.pgPool.on('error', (err, client) => {
			console.log('postgres connection error : ' + err)
		});
		

```

For additional details about this problem visit this [link](https://stackoverflow.com/questions/51821082/in-windows-stopping-postgres-service-causes-node-to-crash-with-error-termina) and [this](https://github.com/brianc/node-postgres/issues/2762).

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [17 November 2022 14:45 UTC](https://discourse.nodered.org/t/solved-node-red-crash-while-restarting-postgres-service-in-windows/70777/2 "2022-11-17T14:45:29Z")

</div>

Have you raised an issue (or better a pull request) on that nodes repository ? Would be great to get it fixed for all..

> **[GitHub - alexandrainst/node-red-contrib-postgresql: Node-RED node for...](https://github.com/alexandrainst/node-red-contrib-postgresql)**
>
> Node-RED node for PostgreSQL, supporting parameters, split, back-pressure - GitHub - alexandrainst/node-red-contrib-postgresql: Node-RED node for PostgreSQL, supporting parameters, split, back-pres...

---

<div class="post-metadata">

**Author:** ![Josh](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/josh/32/62208_2.png) [@Josh](https://discourse.nodered.org/u/Josh)\
**Post date:** [17 November 2022 15:17 UTC](https://discourse.nodered.org/t/solved-node-red-crash-while-restarting-postgres-service-in-windows/70777/3 "2022-11-17T15:17:21Z")

</div>

I will do that.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [16 January 2023 15:18 UTC](https://discourse.nodered.org/t/solved-node-red-crash-while-restarting-postgres-service-in-windows/70777/4 "2023-01-16T15:18:07Z")

</div>

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