# Node-red not responsive hangs on "Starting flows"

**URL:** https://discourse.nodered.org/t/node-red-not-responsive-hangs-on-starting-flows/84699
**Category:** General
**Created:** [18 January 2024 19:13 UTC](https://discourse.nodered.org/t/node-red-not-responsive-hangs-on-starting-flows/84699 "2024-01-18T19:13:55Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![lizzardguki](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/lizzardguki/32/103637_2.png) [@lizzardguki](https://discourse.nodered.org/u/lizzardguki)
#### Post date: [18 January 2024 19:13 UTC](https://discourse.nodered.org/t/node-red-not-responsive-hangs-on-starting-flows/84699/1 "2024-01-18T19:13:55Z")

</div>

So , was developing a "compiler" for a fleet of node-red devices, but got in a problem.  
Whenever i install all of the dependencies from a list, and then restart node-red it hangs on :

```auto
Jan 18 18:59:55 G100-sn775 Node-RED[926]: 18 Jan 18:59:55 - [info] Server now running at http://127.0.0.1:1880/
Jan 18 18:59:55 G100-sn775 Node-RED[926]: 18 Jan 18:59:55 - [info] Starting flows

```

WebUI is not loading and stopping it (either with node-red-stop or systemctl) takes ~3-4 minutes.

**node-red --safe** does bring up the WebUI, and after deployment everything work as expected.

was thinking that it was dependency related (.node-red/package.json)  
but its actually flow related, and that flow haves several functions that use mqtt, modbus-tcp , modbus-serial.  
Any ideas where should i start debugging, or what 'automatic' solution i can incorporate ,maybe declaring them in settings.js instead of the function ?

---

<div class="post-metadata">

### Author: ![GogoVega](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gogovega/32/71313_2.png) [@GogoVega](https://discourse.nodered.org/u/GogoVega)
#### Post date: [18 January 2024 19:30 UTC](https://discourse.nodered.org/t/node-red-not-responsive-hangs-on-starting-flows/84699/2 "2024-01-18T19:30:06Z")

</div>

> [@lizzardguki](#):
>
> of the function ?

Do you mean you install your dependencies from a node?

---

<div class="post-metadata">

### Author: ![lizzardguki](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/lizzardguki/32/103637_2.png) [@lizzardguki](https://discourse.nodered.org/u/lizzardguki)
#### Post date: [18 January 2024 19:32 UTC](https://discourse.nodered.org/t/node-red-not-responsive-hangs-on-starting-flows/84699/3 "2024-01-18T19:32:02Z")

</div>

Yes, for example :

```auto
[
    {
        "id": "5299ad1a052e1e5c",
        "type": "function",
        "z": "3b94652596fabb28",
        "g": "58f290653fc6823f",
        "name": "SavedData",
        "func": "\nvar session_url = `https://${env.get('configuration').url}/datacalc?config={\"token\":\"${env.get('configuration').token}\"}&hvac=${env.get('configuration').hvacId}`;\nvar config = {\n method: 'get',\n url: session_url,\n headers: {\n\n 'Accept': 'application / json, text/ javascript, */*; q=0.01',\n 'Accept-Language': 'en-US,en;q=0.5',\n 'Accept-Encoding': 'gzip, deflate, br',\n 'X-Operation': 'getdata',\n 'X-Requested-With': 'XMLHttpRequest',\n \"Connection\": \"keep=alive\",\n \"Sec-Fetch-Dest\": \"empty\",\n \"Sec-Fetch-Mode\": \"cors\",\n \"Sec-Fetch-Site\": \"same-origin\"\n }\n};\n\naxios(config)\n .then(function (response) {\n msg.response = response.data.Payload\n node.send(msg);\n })\n .catch(function (error) {\n console.log(error)\n });\n\n\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [
            {
                "var": "axios",
                "module": "axios"
            },
            {
                "var": "btoa",
                "module": "btoa"
            }
        ],
        "x": 230,
        "y": 120,
        "wires": [
            [
                "86e7f39741862c3e"
            ]
        ]
    }
]

```

---

<div class="post-metadata">

### Author: ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)
#### Post date: [18 January 2024 19:38 UTC](https://discourse.nodered.org/t/node-red-not-responsive-hangs-on-starting-flows/84699/4 "2024-01-18T19:38:44Z")

</div>

I think you need to explain more on what you mean by "compiler"

The node you have posted, is just making a web request - not installing dependencies or anything - which seems a really strange thing to do in a Flow IMO

any reason your not using the HTTP Request Node?

also note: you have spaces in-between the accept header value `application/ type`. I don't know if that is valid

---

<div class="post-metadata">

### Author: ![lizzardguki](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/lizzardguki/32/103637_2.png) [@lizzardguki](https://discourse.nodered.org/u/lizzardguki)
#### Post date: [18 January 2024 19:48 UTC](https://discourse.nodered.org/t/node-red-not-responsive-hangs-on-starting-flows/84699/5 "2024-01-18T19:48:00Z")

</div>

So, me and my team developed a flow compiler, we have a config file which we specify, and a flows library in a repository, and based on the config file we craft/compile in to .node-red/flows.json (managing flows and node id , implementing node configs, managing credentials...)  
So sorry if you misunderstood me i have ~25 function nodes using external modules and i think that is what is causing the issue of not starting the flow. But have no idea how to debug it.

---

<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: [18 January 2024 19:50 UTC](https://discourse.nodered.org/t/node-red-not-responsive-hangs-on-starting-flows/84699/6 "2024-01-18T19:50:46Z")

</div>

If you run `top` or a system monitor and then start node red is it hogging the processor? If so you have a loop of some sort in your flows or a function.

---

<div class="post-metadata">

### Author: ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)
#### Post date: [18 January 2024 19:53 UTC](https://discourse.nodered.org/t/node-red-not-responsive-hangs-on-starting-flows/84699/7 "2024-01-18T19:53:50Z")

</div>

As per @Colin's comment, check the process's.

Also - I **strongly** recommend moving away from `var`  
`var` can have an effect on the global context - especially with something called `config` 😬

use `let` or `const`

---

<div class="post-metadata">

### Author: ![lizzardguki](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/lizzardguki/32/103637_2.png) [@lizzardguki](https://discourse.nodered.org/u/lizzardguki)
#### Post date: [18 January 2024 20:01 UTC](https://discourse.nodered.org/t/node-red-not-responsive-hangs-on-starting-flows/84699/8 "2024-01-18T20:01:13Z")

</div>

It's hogging the proc, but i am not understanding how with --safe , and after deployment it works.  
Can't complain its a rather complex flow for managing ventilation system's schedules by mqtt and http 🥇

---

<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: [18 January 2024 20:18 UTC](https://discourse.nodered.org/t/node-red-not-responsive-hangs-on-starting-flows/84699/9 "2024-01-18T20:18:31Z")

</div>

Taking a long time to stop is a classic symptom of processor hogging.

> [@lizzardguki](#):
>
> i am not understanding how with --safe , and after deployment it works.

Possibly a subtle race condition so that a change in the startup sequence changes the symptom.

---

<div class="post-metadata">

### Author: ![xx\_Nexus\_xx](https://avatars.discourse-cdn.com/v4/letter/x/54ee81/32.png) [@xx\_Nexus\_xx](https://discourse.nodered.org/u/xx_Nexus_xx)
#### Post date: [24 January 2024 22:56 UTC](https://discourse.nodered.org/t/node-red-not-responsive-hangs-on-starting-flows/84699/11 "2024-01-24T22:56:21Z")

</div>

I had the same issue a while back.. and got it sorted as below

You have to identify the function or flow causing the "stopping/hanging" of startup.

1. Start in SAFE mode (as you did)
2. Disable latest flows , and keep the ones active you know are working properly
3. Restart in normal mode
4. repeat 1-3 until you have identified which flow is creating the issue
5. Enable the flow which is causing the issue
6. Disable the latest functions or nodes which you suspspect causing the issue
7. Restart in normal mode .. if system fails to start ..tham start in SAFE mode and disable further functios
8. repeat the process until you identified the funcion/node responsible for "Stopping/hanging" the start process

There are several reasons a function/node is not starting up properly during a fresh-start in comparision to a full-deploy afte a Safe-Mode start.

For me it helped to put a delay in front of the function/node when starting up (this will ensure all system resources are up and running)

As soon you have identified the function/node causing the issue you need to investigate specifically in regards to the function/node and may need to reach out to the function/node developer or here in the forum again.

I know this will not help you directly, but hopefully you can noarrow down the issue

have fun 😉

---

<div class="post-metadata">

### Author: ![lizzardguki](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/lizzardguki/32/103637_2.png) [@lizzardguki](https://discourse.nodered.org/u/lizzardguki)
#### Post date: [24 January 2024 23:04 UTC](https://discourse.nodered.org/t/node-red-not-responsive-hangs-on-starting-flows/84699/12 "2024-01-24T23:04:04Z")

</div>

Started redesigning the flow that was crashing. And will try to not start functions on start of the flows, which i think are causing all of these non sense, plus i need to add further functionalities to the flows, and starting from scratch makes the most sense.

---

<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: [24 March 2024 23:04 UTC](https://discourse.nodered.org/t/node-red-not-responsive-hangs-on-starting-flows/84699/13 "2024-03-24T23:04:07Z")

</div>

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