# MQTT Input Node Sends CPU 100%

**URL:** <https://discourse.nodered.org/t/mqtt-input-node-sends-cpu-100/12827>\
**Category:** General\
**Created:** [2 July 2019 13:55 UTC](https://discourse.nodered.org/t/mqtt-input-node-sends-cpu-100/12827 "2019-07-02T13:55:10Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Soloam](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/soloam/32/9834_2.png) [@Soloam](https://discourse.nodered.org/u/Soloam)\
**Post date:** [2 July 2019 13:55 UTC](https://discourse.nodered.org/t/mqtt-input-node-sends-cpu-100/12827/1 "2019-07-02T13:55:11Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [2 July 2019 14:06 UTC](https://discourse.nodered.org/t/mqtt-input-node-sends-cpu-100/12827/2 "2019-07-02T14:06:34Z")

</div>

What version of nodejs?

Is there any message written to the log?

---

<div class="post-metadata">

**Author:** ![Soloam](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/soloam/32/9834_2.png) [@Soloam](https://discourse.nodered.org/u/Soloam)\
**Post date:** [2 July 2019 14:18 UTC](https://discourse.nodered.org/t/mqtt-input-node-sends-cpu-100/12827/3 "2019-07-02T14:18:08Z")

</div>

node v8.11.3

What log? The nodered log? nothing

---

<div class="post-metadata">

**Author:** ![Soloam](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/soloam/32/9834_2.png) [@Soloam](https://discourse.nodered.org/u/Soloam)\
**Post date:** [2 July 2019 14:46 UTC](https://discourse.nodered.org/t/mqtt-input-node-sends-cpu-100/12827/4 "2019-07-02T14:46:58Z")

</div>

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.

---

<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 July 2019 14:51 UTC](https://discourse.nodered.org/t/mqtt-input-node-sends-cpu-100/12827/5 "2019-07-02T14:51:34Z")

</div>

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.

---

<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:** [2 July 2019 15:01 UTC](https://discourse.nodered.org/t/mqtt-input-node-sends-cpu-100/12827/6 "2019-07-02T15:01:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [2 July 2019 15:54 UTC](https://discourse.nodered.org/t/mqtt-input-node-sends-cpu-100/12827/7 "2019-07-02T15:54:31Z")

</div>

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)

---

<div class="post-metadata">

**Author:** ![afelix](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/afelix/32/9743_2.png) [@afelix](https://discourse.nodered.org/u/afelix)\
**Post date:** [2 July 2019 16:01 UTC](https://discourse.nodered.org/t/mqtt-input-node-sends-cpu-100/12827/8 "2019-07-02T16:01:53Z")

</div>

> [@Soloam](#):
>
> tht when I try to access some http node (in)

> [@Soloam](#):
>
> 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...

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.

---

<div class="post-metadata">

**Author:** ![Soloam](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/soloam/32/9834_2.png) [@Soloam](https://discourse.nodered.org/u/Soloam)\
**Post date:** [3 July 2019 00:36 UTC](https://discourse.nodered.org/t/mqtt-input-node-sends-cpu-100/12827/9 "2019-07-03T00:36:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [3 July 2019 05:41 UTC](https://discourse.nodered.org/t/mqtt-input-node-sends-cpu-100/12827/10 "2019-07-03T05:41:17Z")

</div>

Did you check the mqtt brokers ? Use something like [MQTT explorer](http://mqtt-explorer.com) to see what is going on.

---

<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:** [3 July 2019 07:10 UTC](https://discourse.nodered.org/t/mqtt-input-node-sends-cpu-100/12827/11 "2019-07-03T07:10:21Z")

</div>

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.
