node-red / node-red/node-red-nodes
[Daemon node] write can throw and is not caught, crashes NR
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.1k
- Forks
- 612
- Avg merge
- 13h 57m
- Merged PRs (30d)
- 3
Description
Which node are you reporting an issue on?
Daemon
What are the steps to reproduce?
Unknown. Happens sporadically due to unreliable wifi links.
What happens?
Node-RED crashes
15 Nov 10:45:00 - [warn] [daemon:ssh] Restarting : ssh
15 Nov 10:45:01 - [red] Uncaught Exception:
15 Nov 10:45:01 - [error] Error: write EPIPE
at afterWriteDispatched (node:internal/stream_base_commons:160:15)
at writeGeneric (node:internal/stream_base_commons:151:3)
at Socket._writeGeneric (node:net:874:11)
at Socket._write (node:net:886:8)
at writeOrBuffer (node:internal/streams/writable:392:12)
at _write (node:internal/streams/writable:333:10)
at Writable.write (node:internal/streams/writable:337:10)
at DaemonNode.inputlistener [as _inputCallback] (/data/node_modules/node-red-node-daemon/daemon
.js:44:81)
at /usr/src/node-red/node_modules/@node-red/runtime/lib/nodes/Node.js:210:26
at Object.trigger (/usr/src/node-red/node_modules/@node-red/util/lib/hooks.js:166:13)
As of a recent commit Line 44 in daemon.js is now: https://github.com/node-red/node-red-nodes/blob/master/utility/daemon/daemon.js#L53
What do you expect to happen?
I expect the daemon node to catch the exception and handle it gracefully without taking all of NR down.
Please tell us about your environment:
15 Nov 10:45:16 - [info] Node-RED version: v3.0.2
15 Nov 10:45:16 - [info] Node.js version: v18.7.0
15 Nov 10:45:16 - [info] Linux 5.15.0-46-generic x64 LE
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with utility/daemon/daemon.js at the input listener referenced by the stack trace, currently around line 53, and review how writes and stream errors are handled. Reproduce or inspect the sporadic EPIPE failure if possible; done means the daemon node handles the write failure without crashing Node-RED.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- backend, networking
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100