ioBroker / ioBroker.javascript

Script engine for JavaScript and Blockly
MIT License
322 stars 120 forks source link

[Bug]: Script is calling setState more than 1000 times per minute! #1518

Closed svenna1980 closed 4 months ago

svenna1980 commented 4 months ago

I'm sure that

Script type

Blockly

The problem

After updating js controller to 5.0.19 the error occurs "Script is calling setState more than 1000 times per minute! Stopping Script now! Please check your script!". Ram and CPU utilization are normal. The script ran without an error message before the update. It has not been changed for approx. 1.5 years.

iobroker.current.log (in debug mode!)

No response

Version of nodejs

v16.19.0

Version of ioBroker js-controller

5.0.19

Version of adapter

v7.8.0

klein0r commented 4 months ago

The script ran without an error message before the update.

Okay, but it's still possible that setState has been called 1000+ times per minute before. The info has been added. I'll close this issue since no further information have been provided (like the script or a debug log)

svenna1980 commented 4 months ago

Bildschirmfoto vom 2024-03-11 23-08-47 Hello, that is the problem. The script doesnt calls state more than 1000times. I increased the value from 1000 to 10000. After that the error messages came again saying "Script is calling setState more than 10.000 times per minute! I query the 3 power values of a Shelly and use them to calculate the grid reference. The query is in a 1000ms interval. Cant image why there should be 10000 state calls in a minute.

svenna1980 commented 4 months ago

Is it possible to deactivate the function so that the error message no longer appears? Increasing the value to 10,000 does not seem to work either. It is very unfortunate because the script is stopped.

Ilovegym66 commented 4 months ago

The fault is in your blockly, it's a trigger in a trigger!

Correct it and the fault is gone. It's definitly not the adapter.

klein0r commented 4 months ago

Is it possible to deactivate the function so that the error message no longer appears?

Yes, fix your scripts and don't create 4 new triggers every second 😄 Let's say your script runs since an hour. That means, you've already created 14400 triggers...

And when one of your states changes, the setState function will be executed 3600 times... And the problem is getting worse every second.

PS: Mit der kommenden Version wirst Du sogar zusätzlich noch eine Warnung bekommen, dass dein Script extrem viele Trigger erzeugt.

svenna1980 commented 4 months ago

2024-03-12 11_31_52-Window Asche über mein Haupt!
Ashes over my head! After removing unnecessary trigger script is working proberly Thank you for your help and your time. I didn't realize that I had a trigger in the trigger. I would like to hope that the next version works properly. Not that I have to report another error here. :-)