Scripting: alarm scripts get 250 ms default timeout; dispatcher-thread blocking; unbounded recursion can crash the server #779
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Immediate in-process scripting defects found while designing #750 (fixable before/independent of the out-of-process runner — the design's phase P0):
Fixed on master
7d989fb5(4 commits):d683b831scripted-alarm predicates got the generic 250 ms Phase-7 default by omission (virtual tags moved to 2 s in F8b). New node-wideScripting:RunTimeout(default 2 s, clamped 0–60 s with a startup warning); virtual-tag evaluator and alarm engine both use it (DriverHostActor.CreateScriptedAlarmEngine). Calculation keeps its per-driverrunTimeoutMs. Note: a never-returning predicate is now quarantined after ~20 s instead of ~2.5 s.a84d3870virtual tags no longer block a dispatcher thread:IVirtualTagEvaluator.EvaluateAsync(default interface method); Roslyn evaluator awaits the run guard and moves first-use compile to the pool;VirtualTagActorstashes inputs while a run is in flight, so trigger order and per-trigger inputs are unchanged. Calculation/alarm one-at-a-time serialisation deliberately kept (reasoning in docs/VirtualTags.md + #750 design note).9e8b5b0eunbounded recursion crashed the process (reproduced: 7 shapes → child exit 134 / stack overflow). Compile step now injectsScriptStackGuard.Check()(TryEnsureSufficientExecutionStack) into the script body and every lambda/local function/anonymous method → catchableScriptStackExhaustedException, script goes Bad, process stays up. Bounded recursion and expression-tree lambdas unaffected.7d989fb5docs aligned to the code: script authoring + deploy are ConfigEditor (Administrator OR Designer), per AdminUI-001.Evidence (rebased on master, Release 0 warnings/0 errors, AKKA_TEST_TIMEFACTOR=3): Runtime 981 (+3 skip), Core.Scripting 220 (+1 skip, the child half of the containment test), Core.ScriptedAlarms 106, Core.VirtualTags 16, Driver.Calculation 79, Host 247, OpcUaServer 1026 (+1 skip), OpcUaServer.IntegrationTests 132, Driver.Sql 588. Agent also ran them at timefactor 1 with identical results. Every new test was confirmed red with its fix reverted. (One Runtime.Tests failure appeared in a concurrent full-suite run and did not reproduce in 2 isolated reruns — name not captured; treat as #769-class load flake.)