# Node-RED freezes for a few seconds

**URL:** <https://discourse.nodered.org/t/node-red-freezes-for-a-few-seconds/90633>\
**Category:** General\
**Tags:** docker\
**Created:** [2 September 2024 09:19 UTC](https://discourse.nodered.org/t/node-red-freezes-for-a-few-seconds/90633 "2024-09-02T09:19:27Z")\
**Posts on this page:** 16\
**Page:** 2

<div class="post-metadata">

**Author:** ![goncalo.cruz](https://avatars.discourse-cdn.com/v4/letter/g/fbc32d/32.png) [@goncalo.cruz](https://discourse.nodered.org/u/goncalo.cruz)\
**Post date:** [2 September 2024 13:49 UTC](https://discourse.nodered.org/t/node-red-freezes-for-a-few-seconds/90633/21 "2024-09-02T13:49:28Z")

</div>

Yes, I agree with you. We are trying to make an effort to have more crucial information available for those who are developing.  
Look at this message that the OEM manufacturer sent me a few days ago when we were discussing about my issue:

> "Hello Gonçalo,  
> we are now finished our investigations and we now come to the conclusion that we can say that the behavior of Node-RED to stop from time to time for short moments  
> seems to be normal. Even with the newest version of Node-RED and plugins installed in combination with the allocation of more CPU power and RAM for the container.  
> For us, this is also plausible due to the fact that Node-RED is a non-real-time capable system. This is for instance recognisable just if you enter the Node-RED configuration WEB-UI.
> 
> But one thing we could recognize, that using Modbus-Flex-Getter reduced in any case the stability."

---

<div class="post-metadata">

**Author:** ![goncalo.cruz](https://avatars.discourse-cdn.com/v4/letter/g/fbc32d/32.png) [@goncalo.cruz](https://discourse.nodered.org/u/goncalo.cruz)\
**Post date:** [2 September 2024 13:50 UTC](https://discourse.nodered.org/t/node-red-freezes-for-a-few-seconds/90633/22 "2024-09-02T13:50:28Z")

</div>

@TotallyInformation Look at this answer from the OEM manufacturer.

---

<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:** [2 September 2024 14:45 UTC](https://discourse.nodered.org/t/node-red-freezes-for-a-few-seconds/90633/23 "2024-09-02T14:45:44Z")

</div>

I run node-red on numerous low power devices, old Pi Zeros for example. As long as one is not doing anything massively intensive then I don't see pauses. At least not often enough to notice.

How often are you triggering the modbus comms?  
Have you got multiple modbus nodes?

---

<div class="post-metadata">

**Author:** ![goncalo.cruz](https://avatars.discourse-cdn.com/v4/letter/g/fbc32d/32.png) [@goncalo.cruz](https://discourse.nodered.org/u/goncalo.cruz)\
**Post date:** [2 September 2024 14:56 UTC](https://discourse.nodered.org/t/node-red-freezes-for-a-few-seconds/90633/24 "2024-09-02T14:56:55Z")

</div>

I'm triggering the Modbus comms each 2 seconds.  
I used to have multiple Modbus nodes, but now I only have one communicating with several devices (7 devices).  
The problem is that right now I've started a project from scratch and I only have 2 flows and only one is communicating via CAN. The other one is just processing variables. The issue still occurs.

---

<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:** [2 September 2024 15:59 UTC](https://discourse.nodered.org/t/node-red-freezes-for-a-few-seconds/90633/25 "2024-09-02T15:59:51Z")

</div>

> [@goncalo.cruz](#):
>
> I used to have multiple Modbus nodes, but now I only have one communicating with several devices (7 devices).

Do you do that one at a time, waiting for one to complete before you start the next?

Edit: Do you mean one device every two seconds or all of them every 2 secs, which is only about 0.3 secs for each one.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [2 September 2024 16:20 UTC](https://discourse.nodered.org/t/node-red-freezes-for-a-few-seconds/90633/26 "2024-09-02T16:20:03Z")

</div>

> [@Colin](#):
>
> We regularly see posts related to systems with embedded node red that either cannot be updated with the current node-red or do not make vital information accessible to the user.

Yes, this is a regular IoT/embedded system type problem. You also see it on medical devices as well.

Done properly, the manufacturer would surface the Node-RED logs to a web page, or make them accessible to an external syslog or even MQTT. Node-RED has the settings to allow this so it really isn't that hard. I even have a flow that lets me see trace-level logs for the uibuilder runtime on a web page (hosted by uibuilder of course! Very meta) - requires a custom log setting though so can't be done unless someone has access to settings.js.

Hmm, actually, thinking about it, you could probably alter settings.js from Node-RED then restart the device. 🧙‍♂️

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [2 September 2024 16:55 UTC](https://discourse.nodered.org/t/node-red-freezes-for-a-few-seconds/90633/27 "2024-09-02T16:55:54Z")

</div>

> [@goncalo.cruz](#):
>
> Look at this answer from the OEM manufacturer.

Did you mean to attach something there? 🙂

---

<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:** [2 September 2024 18:14 UTC](https://discourse.nodered.org/t/node-red-freezes-for-a-few-seconds/90633/28 "2024-09-02T18:14:06Z")

</div>

I think he refers to the quote in his previous post.

---

<div class="post-metadata">

**Author:** ![goncalo.cruz](https://avatars.discourse-cdn.com/v4/letter/g/fbc32d/32.png) [@goncalo.cruz](https://discourse.nodered.org/u/goncalo.cruz)\
**Post date:** [3 September 2024 10:05 UTC](https://discourse.nodered.org/t/node-red-freezes-for-a-few-seconds/90633/29 "2024-09-03T10:05:54Z")

</div>

I was refering to my reply to @Colin.

---

<div class="post-metadata">

**Author:** ![goncalo.cruz](https://avatars.discourse-cdn.com/v4/letter/g/fbc32d/32.png) [@goncalo.cruz](https://discourse.nodered.org/u/goncalo.cruz)\
**Post date:** [3 September 2024 15:56 UTC](https://discourse.nodered.org/t/node-red-freezes-for-a-few-seconds/90633/30 "2024-09-03T15:56:06Z")

</div>

Hello Colin.  
Hope you're doing fine.  
I think I found a big clue regarding the freezing problem when I was testing with only 2 flows and CAN communication.  
I noticed that it wasn't the Node-RED, but the socketcan nodes. I connected a Debug node to the socketcan read node and checked that from time to time I stopped receiving CAN frames, even though I was sending each 100ms.  
In fact, the problem may lie with the physical communication interfaces (RS-485 and CAN).  
@TotallyInformation @Trying_to_learn

---

<div class="post-metadata">

**Author:** ![btsimonh](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/btsimonh/32/3318_2.png) [@btsimonh](https://discourse.nodered.org/u/btsimonh)\
**Post date:** [5 September 2024 15:41 UTC](https://discourse.nodered.org/t/node-red-freezes-for-a-few-seconds/90633/31 "2024-09-05T15:41:04Z")

</div>

In general, another thing to watch out for is cloning of messages.  
IF your messages could contain larger amounts of data, they are still really quick between nodes if there is no cloning. However, for example attaching a debug node to monitor a message COULD cause a clone, and a clone of large data can take a long time.  
It does not sound like this is your issue, but it's something to be aware of.  
It's also important to understand garbage collection if expecting 100ms response times. NodeJS can hang for 100-200ms when it hits a complex garbage collect; not a great deal you can do about it since NR and it's supporting libraries are complex beasts :(.

br,  
Simon

---

<div class="post-metadata">

**Author:** ![goncalo.cruz](https://avatars.discourse-cdn.com/v4/letter/g/fbc32d/32.png) [@goncalo.cruz](https://discourse.nodered.org/u/goncalo.cruz)\
**Post date:** [5 September 2024 16:35 UTC](https://discourse.nodered.org/t/node-red-freezes-for-a-few-seconds/90633/32 "2024-09-05T16:35:44Z")

</div>

Hello Simon,

Thank you for your feedback!  
When you talk about **“Cloning”** , do you mean passing the same message to multiple nodes?  
In fact, I deleted all my Debug nodes but I still have many Function nodes in parallel.

Best regards,  
Gonçalo Cruz

---

<div class="post-metadata">

**Author:** ![btsimonh](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/btsimonh/32/3318_2.png) [@btsimonh](https://discourse.nodered.org/u/btsimonh)\
**Post date:** [5 September 2024 17:07 UTC](https://discourse.nodered.org/t/node-red-freezes-for-a-few-seconds/90633/33 "2024-09-05T17:07:39Z")

</div>

yep. Any place where you have two wires out of a single output. But in modern NR, I believe you also have some control over cloning.  
But it won't be a problem unless you have large data - it's just something to be aware of.  
ONE way around it is to store the data in global or flow, and reference it using an id, then pass the id.  
(I found this when doing a lot of image processing...)

---

<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:** [5 September 2024 17:11 UTC](https://discourse.nodered.org/t/node-red-freezes-for-a-few-seconds/90633/34 "2024-09-05T17:11:08Z")

</div>

Another (and arguably better way) is to keep the data in the `msg` and do things in series (it is very easy to hit concurrency issues with context). You dont _have_ to stick with msg.payload. You can put stuff into `msg.myProp1`, `msg.myOtherProp`, `msg.sommitElseEntierly` and pass it to the next node and so on. It is only when you branch off to multiple wires that you start cloning.

---

<div class="post-metadata">

**Author:** ![gdiana](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gdiana/32/90246_2.png) [@gdiana](https://discourse.nodered.org/u/gdiana)\
**Post date:** [8 September 2024 13:55 UTC](https://discourse.nodered.org/t/node-red-freezes-for-a-few-seconds/90633/35 "2024-09-08T13:55:07Z")

</div>

You appear to be reading form several devices, some using MB and others using CAN?

In terms of MB each MBDevice must have it own server defined and what if you have MB regsiters of maybe different types in different register blocks.

I have had issues where reading different MB register ranges and types can create problems?

However, the information provided is scant so one is unable to assess the issues I noted?

---

<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:** [7 December 2024 13:56 UTC](https://discourse.nodered.org/t/node-red-freezes-for-a-few-seconds/90633/36 "2024-12-07T13:56:04Z")

</div>

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

[Previous page](https://discourse.nodered.org/t/node-red-freezes-for-a-few-seconds/90633.md?page=1)
