Debugging 100% CPU
Debugging 100% CPU
I've probably written some logical rules that trigger constantly and therefore send the CPU usage to the roof. Can I configure some logging or is the only alternative to add console loggings explicitly in the module?
Re: Debugging 100% CPU
A "nice to have"-feature would be to be able to configure the "core" module with throttling/damping so that X number of events from the same module in Y number of seconds, should throw an error (+info in GUI) and make a delay. In this way the server would still be responsive and possible to shut it down, instead of having to kill the process? Or is it not that usual to mess up a logical rule? I'd guess that the more rules the bigger risk. The "ultimate" solution is a generated graph that shows the dependencies between devices and modules in logical rules, if-statements...wishing 

Re: Debugging 100% CPU
Disable/re-enable your rules one by one to find the offender.bogr wrote:I've probably written some logical rules that trigger constantly and therefore send the CPU usage to the roof. Can I configure some logging or is the only alternative to add console loggings explicitly in the module?
Do not make complex rules, try to split in multiple simple rules if possible. ("Industrial grade" rule engines like Drools do split-up complex rules at compile time. ZWay doesn't)
Re: Debugging 100% CPU
Yes, they are quite simple actually, but I'm a bit lazy to go over them one by one
. I think I'll add a console.log to the logical rule module and then I can easily see which rule(s) is/are triggered over and over. I have some virtual switches to be able to handle different cases in my alarm, and I've probably messed up some rule that triggers one switch and another that triggers it back - I think at least.
Thanx for your input.

Thanx for your input.
Re: Debugging 100% CPU
Hmm, it doesn't seem like my assumption was correct. I have a code switch and I've configured ON like:
The LightScene_51 works if I trigger it from the GUI, but it does not seem to be triggered from the code switch. It actually makes the server go berserk
. I've put it in a room with anonymous access, so it can't have anything to do with access right, and I can actually trigger it from another raspi. I've also put curl in .syscommands so I can't understand why it does not work. Trying:
does not give any errors - in the browser the output is [1536,""], but the scene is not triggered.
Code: Select all
system('aplay /home/pi/sounds/larmOn.wav; curl http://ip:8083/ZAutomation/api/v1/devices/LightScene_51/command/on')

Code: Select all
http://ip:8083/ZWaveAPI/Run/system('curl http://ip:8083/ZAutomation/api/v1/devices/LightScene_51/command/on')
Re: Debugging 100% CPU
Don't know why it didn't work, I tried to replace the url with just google.com, and the server did not hang in that case. I gave up the curl-nuisance and replaced it with:
so now it finally works. Even "feels" like a better solution.
Code: Select all
controller.devices.get('LightScene_51').performCommand('on')
Re: Debugging 100% CPU
Why do you call HTTP from the server itself, while you can do it via JS command (in your last message).
Note that HTTP server is synchronous, so JS hangs on serving messages. If you do it from system, you also block the process until system is returned, but system can not return until HTTP answers, while HTTP can not answer until system() is over. Classical deadlock
Note that HTTP server is synchronous, so JS hangs on serving messages. If you do it from system, you also block the process until system is returned, but system can not return until HTTP answers, while HTTP can not answer until system() is over. Classical deadlock

Re: Debugging 100% CPU
ahaaaa, didn't think of that
. Thanx for the great clarification 

