Segmentation fault in Node-red

I installed Node-red using Docker on an ARM architecture Ubuntu system,

I have written a relatively complex Node-red flowchart, and when I use Docker logs to view the logs of Node red, I find that it occasionally encounters Segmentation fault errors:

./entrypoint.sh: line 14: 6 Segmentation fault (core dumped) /usr/local/bin/node $NODE_OPTIONS node_modules/node-red/red.js --userDir /data $FLOWS "${@}"

What are the common reasons for this error?
Is there a suggested direction for investigation? Thanks

There are no common reasons as it is a problem that is very rarely seen.

Have a look in syslog and see if there is anything unexpected around the time of the problem.

Is the system performing perfectly in every other way? A hardware problem is one possibility.

Can you post the node red startup log please? Copy/paste, not screenshot.
Also show us what is in your package.json (probably in ~/.node-red, if not there then the startup log will tell you where it is.

12 Jun 00:47:59 - [info]

Welcome to Node-RED

12 Jun 00:47:59 - [info] Node-RED version: v3.1.0
12 Jun 00:47:59 - [info] Node.js version: v16.20.2
12 Jun 00:47:59 - [info] Linux 3.10.65-rt69 arm LE
12 Jun 00:48:03 - [info] Loading palette nodes
12 Jun 00:48:15 - [info] Settings file : /data/settings.js
12 Jun 00:48:15 - [info] Context store : 'default' [module=memory]
12 Jun 00:48:15 - [info] User directory : /data
12 Jun 00:48:15 - [warn] Projects disabled : editorTheme.projects.enabled=false
12 Jun 00:48:15 - [info] Flows file : /data/flows.json
12 Jun 00:48:15 - [info] Server now running at http://127.0.0.1:1880/
12 Jun 00:48:16 - [warn]


Your flow credentials file is encrypted using a system-generated key.

If the system-generated key is lost for any reason, your credentials
file will not be recoverable, you will have to delete it and re-enter
your credentials.

You should set your own key using the 'credentialSecret' option in
your settings file. Node-RED will then re-encrypt your credentials
file using your chosen key the next time you deploy a change.

12 Jun 00:48:18 - [info] Starting flows
12 Jun 00:48:23 - [info] Started flows

I am using the Docker version of node red, and it seems that the package.json you need is not in the ~/.node red,

May I ask what the role of package.json in the directory ~/.node red is in node red? I will try to see if I can find similar feature files in Docker

/data# cat package.json
{
"name": "node-red-project",
"description": "A Node-RED Project",
"version": "0.0.1",
"private": true,
"dependencies": {
"node-red-contrib-bacnet": "~0.2.7",
"node-red-contrib-buffer-parser": "~3.2.2",
"node-red-contrib-counter": "~0.1.6",
"node-red-contrib-cron-plus": "~2.1.0",
"node-red-contrib-flogger": "~1.2.2",
"node-red-contrib-ftp": "~0.0.8",
"node-red-contrib-ftp-server": "~1.0.3",
"node-red-contrib-loop": "~1.0.1",
"node-red-contrib-merge": "~0.1.1",
"node-red-contrib-merge-topic": "~0.1.2",
"node-red-contrib-modbus": "~5.26.0",
"node-red-contrib-queue-gate": "~1.5.5",
"node-red-contrib-semaphore": "~1.0.1",
"node-red-contrib-utils": "~0.1.0",
"node-red-node-sqlite": "~1.1.0"
}
}

is this?

Yes, that is it. It shows what additional nodes you have installed.

Make sure you are using the latest versions of all additional nodes you have installed (use Manage Palette to do that). Also I suggest moving to an up to date version of node red (currently 3.1.10 I think) and a current version of node.js.

By the way, if you surround text such as the log and package.json with lines containing just three backtick characters then that will stop the forum from interpreting them as markdown.

What hardware are you running on?

This node installs serial port.

Serial port uses compiled code and sometimes, for certain architectures the precompiled binaries do not exist and need to be built.

This is the most common reason - a simple search on this forum reveals the answer: Search results for 'Segmentation fault #docker order:latest' - Node-RED Forum

TLDR;

You probably need to rebuild the node modules

log into the docker shell and run npm rebuild --build-from-source in the node_modules directory of the /data directory.


NOTE: the image will also need the necessary tools for the compilation. Good luck.

Thank you for your suggestion,

May I ask if you are referring to the chip model or not?

I am using an embedded intelligent gateway device based on Ubuntu (arm v7 architecture);

Thank you for your guidance,

But in my flowchart, the serial function of the modbus node was not used,

In my flowchart, only used modbus-tcp communication,

May I ask if it is necessary to manually recompile "node-red-contrib-modbus" even without using serial port functionality?

I dont know, I would need to inspect the source code to see if it is required anywhere (even if it is not being instantiated).

This thread might help: Node-RED crash (SIGSEGV) when any writable file is set as the serial device · Issue #358 · BiancoRoyal/node-red-contrib-modbus · GitHub

NOTE: modbus nodes might not be the only nodes requiring a rebuild (other nodes you have installed might have binary components).

Thank you, I will try to find the problem.

But I have a question, why does the error message when Node red crashes not indicate which node is causing the error?

a quick google search would tell you why, but let me do that for you :wink:

Joking aside, it is not as easy as you might think. The problem is occuring in some compiled code several layers down (Node-RED code -> NodeJS -> Module -> Sub-Module -> Sub-Module) (I even excluded things like async/callbacks, stack and v8 engine for brevity). We would require a backtrace and then the author of the node (or sub module or sub sub sub x n module) would probably need to analyse the output.

Thank you very much. It sounds very complicated╰(°▽°)╯

No worries. Please let us know if you get past this issue and what steps you took (could be useful for future readers).

Regards, Steve.

Okay, I will try my best to solve it. If there is any progress, I will share the solution

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