How to abort a logging attempt?
-
If a point triggers an update to a meta point and before or during the processing of the script one of the points in context is disabled and script exits, how can I abort the point value logging for this event?
-
Hi Phillip,
For a meta point, you should be able to do something like
/* other scripting, get 'value' */ function isAnyPointNowDisabled() { for(var varName in CONTEXT_POINTS) if(!RuntimeManager.isDataPointEnabled(this[varName].getDataPointWrapper().getXid())) return true; return false; } if( isAnyPointNowDisabled() ) return UNCHANGED; return value;
Interesting thing to want to do. The meta point won't execute if a context point was disabled when it was supposed to begin execution.
-
Yes indeed, I am trying to stop one of our cloud servers from it's daily out of memory crash which started occurring March 5th. The crash log had reported script errors with a meta datasource's context point being disabled ...
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_131]
ERROR 2018-03-08T16:49:10,221 (com.serotonin.m2m2.meta.JavaScriptPointLocatorRT.createContext:108) - Point with id 370 for variable named 'HVAC' is disabled
com.serotonin.m2m2.rt.script.DataPointStateException: Point with id 370 for variable named 'HVAC' is disabled at com.serotonin.m2m2.rt.script.ScriptExecutor.convertScriptContext(ScriptExecutor.java:57) ~[mango-3.3.2.jar:?]so I added if (point1.enabled) { do stuff } which stopped the errors but I was logging 0 if the point was disabled.
I will change it so it returns UNCHANGED.Interestingly, both servers are configured with exactly the same thread and NoSQL configuration. One server is 2.8.8 has been running for months without issue and the other is v3.3 with the same setup and crashes out daily running out of memory. I might be grasping at straws here but at least the script errors went away.. Thanks for the quick response. I am experimenting with G1GC now vs ConcMarkSweepGC.
-
Hi Phillip,
There were a couple issues fixed in 3.3.2 / 3.3.3 that are worth updating for. If you're on 3.3 I would encourage you to update to 3.3.3 if you are not on it.
-
Will do, Thanks