Troubleshoot high CPU usage?

1,479 views
Skip to first unread message

Cory Guynn

unread,
Mar 18, 2016, 8:28:03 AM3/18/16
to Node-RED
I would like some guidance to understand why Node-RED is consuming 100% of my CPU?

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND              

 5685 root      20   0 1332092 182812  11840 R 100.1  3.0   1990:31 node-red             



I have a pretty large collection of flows, so I could potentially chop it up and see which one is causing the impact, but that sound tedious. Is there another way, such as some debugging trick to see what might actually be happening?


Thanks


Dave C-J

unread,
Mar 19, 2016, 7:06:14 PM3/19/16
to node...@googlegroups.com
Nothing obvious springs to mind. The times I have seen that tend to be either trying to open a no longer existing serialport or bluetooth device. Usually these seem have some native binding that spins in a loop trying to connect... so maybe a place to start... 

but I'd be interested in what you do eventually find.

Cory Guynn

unread,
Mar 19, 2016, 8:35:23 PM3/19/16
to node...@googlegroups.com

Bummer, I suspect it's the UI nodes I added, but was reluctant to undo all that work..
Time to back up and start removing stuff.

On 19 Mar 2016 23:06, "Dave C-J" <dce...@gmail.com> wrote:
Nothing obvious springs to mind. The times I have seen that tend to be either trying to open a no longer existing serialport or bluetooth device. Usually these seem have some native binding that spins in a loop trying to connect... so maybe a place to start... 

but I'd be interested in what you do eventually find.

--
http://nodered.org
 
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to a topic in the Google Groups "Node-RED" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/node-red/7PQRmkGMs98/unsubscribe.
To unsubscribe from this group and all its topics, send an email to node-red+u...@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
For more options, visit https://groups.google.com/d/optout.

Mark Setrem

unread,
Mar 20, 2016, 3:29:24 PM3/20/16
to Node-RED
I've got the same issue with one of my Pi's and I'm not running the UI nodes, although I am using web sockets.

It is accessing serial ports ( Both /dev/ttyAMA0 (via a serial node) and /dev/ttyUSB0  (via RFXCOM nodes)) but there are only the two serial ports configured according to the 
config tab.

If I deploy anything the CPU activity goes to 94-98% and stays there for 30-60 seconds, which is significantly longer than any of my other pi's 

I thought it was a corrupted SDcard but swapped it out with no effect.

Running:

20 Mar 19:24:15 - [info] Node-RED version: v0.13.1

20 Mar 19:24:15 - [info] Node.js  version: v0.12.6



Max Hadley

unread,
Mar 20, 2016, 4:09:13 PM3/20/16
to Node-RED
RFXcom has a busy wait loop, but it should never spin for more than 50 ms. However there could conceivably be a bug. Can you see if the problem goes away with no RFXtrx connected and let me know

Thanks

Max

Mark Setrem

unread,
Mar 20, 2016, 4:44:00 PM3/20/16
to Node-RED
Max, will do but it will be a couple of days

Julian Knight

unread,
Mar 20, 2016, 9:05:11 PM3/20/16
to Node-RED
It might be worth moving the hardware interactions to their own instance of NR. I've considered this myself since I seem to get lots of errors when a node type updates that uses the serial port (I often have to delete the node_modules folder and do a new npm install). Having them in their own instance would make things more stable.

It would also help you decide whether it was the serial stuff or something else.

Greg EVA

unread,
Mar 21, 2016, 11:48:05 AM3/21/16
to Node-RED
I have (and still do) experience this sort of thing with OpenHAB.  The problem is the Java serial port driver used.  There are many known problems with this in Java..... so there could be a similar issue with the underpinning serial driver used in Node.js.

Julian Knight

unread,
Mar 21, 2016, 6:46:07 PM3/21/16
to Node-RED
If that's the only problem you've jot with a Java app, you are doing really well! ;-)

I suspect that the problems lie further down the stack to be honest.

Mark Setrem

unread,
Mar 22, 2016, 4:34:08 PM3/22/16
to Node-RED
Max,

Good news for you, unfortunately unplugging the RFXcom and deleting the flows containing RFXCom nodes made no difference still over 38 secs of 96+% cpu activity.

Julian Knight

unread,
Mar 22, 2016, 6:20:11 PM3/22/16
to Node-RED
What is that actually running on? And what resources does the host have?

Mark Setrem

unread,
Mar 22, 2016, 7:03:38 PM3/22/16
to Node-RED
Its running on a RPiB+ connected via Ethernet

Running RFXTrx (lights) to MQTT 

and MQTT to RFXTrx (lights)

and one other tab that polls my sky box every 30 seconds and if the channel has changed then publishes that to MQTT

Has been successfully running on the same hardware without any noticeable long delays for a year.  Finally got round to updating and now delays as above...


Julian Knight

unread,
Mar 24, 2016, 5:54:33 AM3/24/16
to Node-RED
OK, so what I was thinking is whether something is using all the memory? Shouldn't really cause high CPU but possibly a poorly written application might not like having its pagable memory dumped regularly.

Mark Setrem

unread,
Apr 2, 2016, 2:03:59 PM4/2/16
to Node-RED
Upgrading nodejs from v4.2.1 to v4.3.2 appears to have fixed the issue for me 60ish seconds to deploy to ~5seconds

Dave C-J

unread,
Apr 2, 2016, 6:24:29 PM4/2/16
to node...@googlegroups.com
Of course the latest LTS is now 4.4.2 .. but hey - they never stop !
Reply all
Reply to author
Forward
0 new messages