Here the steps that i took to find the cause of the problem:
-
I used the profiler node of @BartButenaers to create the .cpuprofile file and loaded it like described into the chrome developer tools (my CPU usage was at time at 100%).
-
Then you get this view:
I sorted by "Heavy (Bottom Up)" and Self-Time and checked then line by line the corresponding source code that can be seen in the right column. I tried to find the first occurrence of code that didn't look like Node-RED internals and seem to be caused by my own flows.
In my case this was the second line. It told me, that there is CPU time wasting in node with id "blabla". With this id i could check in my flows which node caused the problem.
- Try to find the cause:
In my case it was a function node behind a catch node that i used to create messages that will be sent via telegram to my smart phone. This function was intended to report me fast, if anything in my smart home and automation system fails.
This catch node belongs to a weather cloud API that reads several thermal sensors in my house. Obvisiously this API is sometimes not reachable, what leads to errors and triggers the catch node.
The flow:
Have a look into my simple code within the function node:
It seems that the HTTP status code is not piped to the catch clause and cannot been integrated therefore in the telegram message. I removed the appending of the msg.statusCode and now everything runs fine. Sadly Node-RED didn't get me something like a null pointer or similar. Or it was my bad that it was catched by catch node too and so i got the loop.
I hope you understood what I did and what steps i took to get the problem solved. Feel free to ask for more details.
Thank you all, especially @BartButenaers and have a nice day!