# Segmentation fault in Node-red

**URL:** <https://discourse.nodered.org/t/segmentation-fault-in-node-red/88630>\
**Category:** General\
**Tags:** docker\
**Created:** [12 June 2024 06:14 UTC](https://discourse.nodered.org/t/segmentation-fault-in-node-red/88630 "2024-06-12T06:14:32Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yesung](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/yesung/32/87392_2.png) [@Yesung](https://discourse.nodered.org/u/Yesung)\
**Post date:** [12 June 2024 06:14 UTC](https://discourse.nodered.org/t/segmentation-fault-in-node-red/88630/1 "2024-06-12T06:14:32Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [12 June 2024 08:02 UTC](https://discourse.nodered.org/t/segmentation-fault-in-node-red/88630/2 "2024-06-12T08:02:16Z")

</div>

> [@Yesung](#):
>
> What are the common reasons for this error?

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.

---

<div class="post-metadata">

**Author:** ![Yesung](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/yesung/32/87392_2.png) [@Yesung](https://discourse.nodered.org/u/Yesung)\
**Post date:** [12 June 2024 08:17 UTC](https://discourse.nodered.org/t/segmentation-fault-in-node-red/88630/3 "2024-06-12T08:17:31Z")

</div>

> [@Colin](#):
>
> (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/](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

---

<div class="post-metadata">

**Author:** ![Yesung](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/yesung/32/87392_2.png) [@Yesung](https://discourse.nodered.org/u/Yesung)\
**Post date:** [12 June 2024 08:25 UTC](https://discourse.nodered.org/t/segmentation-fault-in-node-red/88630/4 "2024-06-12T08:25:48Z")

</div>

> [@Colin](#):
>
> Also show us what is in your package.json

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

---

<div class="post-metadata">

**Author:** ![Yesung](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/yesung/32/87392_2.png) [@Yesung](https://discourse.nodered.org/u/Yesung)\
**Post date:** [12 June 2024 08:27 UTC](https://discourse.nodered.org/t/segmentation-fault-in-node-red/88630/5 "2024-06-12T08:27:34Z")

</div>

> [@Colin](#):
>
> Also show us what is in your package.json

/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?

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [12 June 2024 08:33 UTC](https://discourse.nodered.org/t/segmentation-fault-in-node-red/88630/6 "2024-06-12T08:33:44Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [12 June 2024 08:41 UTC](https://discourse.nodered.org/t/segmentation-fault-in-node-red/88630/7 "2024-06-12T08:41:22Z")

</div>

> [@Yesung](#):
>
> "node-red-contrib-modbus": "~5.26.0",

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](https://discourse.nodered.org/search?q=Segmentation%20fault%20%23docker%20order%3Alatest)

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.

---

<div class="post-metadata">

**Author:** ![Yesung](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/yesung/32/87392_2.png) [@Yesung](https://discourse.nodered.org/u/Yesung)\
**Post date:** [12 June 2024 08:41 UTC](https://discourse.nodered.org/t/segmentation-fault-in-node-red/88630/8 "2024-06-12T08:41:55Z")

</div>

> [@Colin](#):
>
> What hardware are you running on?

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);

---

<div class="post-metadata">

**Author:** ![Yesung](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/yesung/32/87392_2.png) [@Yesung](https://discourse.nodered.org/u/Yesung)\
**Post date:** [12 June 2024 08:50 UTC](https://discourse.nodered.org/t/segmentation-fault-in-node-red/88630/9 "2024-06-12T08:50:07Z")

</div>

> [@Steve-Mcl](#):
>
> Serial port uses compiled code and sometimes, for certain architectures the precompiled binaries do not exist and need to be built.

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?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [12 June 2024 08:52 UTC](https://discourse.nodered.org/t/segmentation-fault-in-node-red/88630/10 "2024-06-12T08:52:45Z")

</div>

> [@Yesung](#):
>
> 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 `require`d 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](https://github.com/BiancoRoyal/node-red-contrib-modbus/issues/358#issuecomment-1455182652)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [12 June 2024 08:54 UTC](https://discourse.nodered.org/t/segmentation-fault-in-node-red/88630/11 "2024-06-12T08:54:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Yesung](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/yesung/32/87392_2.png) [@Yesung](https://discourse.nodered.org/u/Yesung)\
**Post date:** [12 June 2024 09:08 UTC](https://discourse.nodered.org/t/segmentation-fault-in-node-red/88630/12 "2024-06-12T09:08:35Z")

</div>

> [@Steve-Mcl](#):
>
> 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?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [12 June 2024 09:22 UTC](https://discourse.nodered.org/t/segmentation-fault-in-node-red/88630/13 "2024-06-12T09:22:30Z")

</div>

> [@Yesung](#):
>
> 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 😉

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.

---

<div class="post-metadata">

**Author:** ![Yesung](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/yesung/32/87392_2.png) [@Yesung](https://discourse.nodered.org/u/Yesung)\
**Post date:** [12 June 2024 09:37 UTC](https://discourse.nodered.org/t/segmentation-fault-in-node-red/88630/15 "2024-06-12T09:37:44Z")

</div>

> [@Steve-Mcl](#):
>
> a quick google search would tell you why, but let me do that for you 😉
> 
> 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╰(_°▽°_)╯

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [12 June 2024 09:41 UTC](https://discourse.nodered.org/t/segmentation-fault-in-node-red/88630/16 "2024-06-12T09:41:21Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Yesung](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/yesung/32/87392_2.png) [@Yesung](https://discourse.nodered.org/u/Yesung)\
**Post date:** [13 June 2024 00:40 UTC](https://discourse.nodered.org/t/segmentation-fault-in-node-red/88630/17 "2024-06-13T00:40:30Z")

</div>

> [@Steve-Mcl](#):
>
> Please let us know if you get past this issue and what steps you took (could be useful for future readers)

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

---

<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:** [11 September 2024 00:40 UTC](https://discourse.nodered.org/t/segmentation-fault-in-node-red/88630/18 "2024-09-11T00:40:50Z")

</div>

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