alexandrainst / alexandrainst/node-red-contrib-postgresql

Node-RED crashes when Postgres terminates connection unexpectedly due to out of memory error

Open
#97 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

help wanted
Dominant language
HTML
Stars
38
Forks
12
Avg merge
4h 1m
Merged PRs (30d)
2

Description

This looks related to https://github.com/alexandrainst/node-red-contrib-postgresql/pull/50

Node-RED v14.2
node.js v22.11.0

I am executing a query that occasionally causes an out of memory error in Postgres. This throws an uncaught exception which crashes Node-RED

8 Jan 16:29:16 - [error] [postgresql:Foo Query] error: out of memory
8 Jan 16:29:16 - [red] Uncaught Exception:
8 Jan 16:29:16 - [error] Error: Connection terminated unexpectedly
    at Connection.<anonymous> (/data/node_modules/pg/lib/client.js:131:73)
    at Object.onceWrapper (node:events:632:28)
    at Connection.emit (node:events:518:28)
    at Connection.emit (node:domain:489:12)
    at Socket.<anonymous> (/data/node_modules/pg/lib/connection.js:62:12)
    at Socket.emit (node:events:530:35)
    at Socket.emit (node:domain:489:12)
    at TCP.<anonymous> (node:net:343:12)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the linked pull request and the stack-trace entry points in pg/lib/client.js and pg/lib/connection.js, then trace how node-red-contrib-postgresql handles a terminated connection. Reproduce the out-of-memory termination if possible and define done as preventing the uncaught exception from crashing Node-RED, with coverage for this failure path.

Written by the indexing model from the issue text.

Assessment

Tech stack
nodejs, postgresql
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.