MQTT Input Node Sends CPU 100%

Hello, I have been having a problem in nodered (currently on 0.20.6, don't know since when this is happening) tht when I try to access some http node (in) it sends my cpu to 100% and takes a long time, this occurs on a simple node that only gets a request http, sets a payload with change and send's the output.

Any one with similar problem? Who can I debug this?

Thank you

What version of nodejs?

Is there any message written to the log?

node v8.11.3

What log? The nodered log? nothing

I tried to disable flow by flow util the problem stopped, I don't know what is the connection, but the problem stops when I disable the flows that have MQTT connections. When I start enabling the flows with MQTT connections I start having huge CPU spikes and delay in the browser when accessing the http node... I keep enabling the flows until the spike is so big that it goes to 100% and I get a timeout in the browser.

Possibly you have an mqtt loop. Run an MQTT client (for example mosquitto_sub) and subscribe to "#" then you will see which topics are looping, if any.
[Edit] Alternatively, since you mention and http in node, are you sending that to mqtt? Perhaps you are sending a huge buffer to mqtt or something similar.

A loop via MQTT sounds plausible. Perhaps you subscribe to a topic then publish it?

or maybe you have two MQTT connections with the same clientID so they are knocking each other off the network. (though the loop is more likely)

Might be a bit of a dumb question from my side, but does your flow look like
Http in -> other things -> mqtt publish?
Is there also a http response (out) that originates from that same http in? Because the response node is what the browser is waiting for, and it will only give back something when that page is trying to load when the http response node is reached.

No, the flow is super simple, enter a request, change the payload with a change node and call http response! Can it be something related with the operating system (freenas, freebsd) or with the node version?

I have 3 mqtt brokers, in63 different machines, can it be related with that?

I tried the debug logging, but no relevant information is provided!

Thank you

Did you check the mqtt brokers ? Use something like MQTT explorer to see what is going on.

You will just have to keep breaking the flow up until you find the culprit. For example, remove the wire feeding the http node and see what happens. If that is ok then put that back and break it after the http node. If it is still ok then it is not the http node. Carry on until you find the culprit.

2 Likes