fix(alarms): #937 review r2 — deadline/poison refusals unsent, Call size quota, expired asks skip the engine, mutation-counter revert guard
M1: a scripted method whose request deadline leaves < the dispatch floor, or that follows an unanswered scripted method in the same Call, is refused BadTimeout in its handler (unsent, unapplied); OpcUa:Quotas:MaxNodesPerMethodCall = 1000. M2: ExecuteAlarmCommand carries the asker's deadline; an expired ask skips the engine and is not remembered (the broadcast copy applies). L1: revert guarded by a per-condition mutation counter; raw severity restored. L5 + nits: docs, stale comment. SDK check: no Part 9 handler calls our delegate before its own validation. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
+17
-1
@@ -438,7 +438,14 @@ of which blocks under the node manager's `Lock`:
|
||||
revert. Cheap refusals the engine would make (a blank scripted AddComment ⇒ `BadInvalidArgument`) happen in the
|
||||
handler, before the SDK applies anything.
|
||||
3. **Load bound** — at most 64 asks outstanding node-wide (`MaxScriptedCommandsInFlight`); past it the call is refused
|
||||
`BadTooManyOperations` before anything is applied or sent. Each request's 5 s bound starts when its own ask is sent.
|
||||
`BadTooManyOperations` before anything is applied or sent. Each request's 5 s bound starts when its own ask is sent and
|
||||
is cut by the request deadline; a scripted method whose deadline leaves less than 250 ms (after a 250 ms grace) is
|
||||
refused `BadTimeout` unsent, and after the FIRST scripted method of a batch that got no answer every later scripted
|
||||
method of that batch is refused `BadTimeout` unsent (non-scripted methods in the batch still run) — so a wedged engine
|
||||
costs one bound per Call, not one per method. A Call carries at most `OpcUa:Quotas:MaxNodesPerMethodCall` methods
|
||||
(default 1000; the SDK default 0 was unlimited; 0 restores it). The host answers an ask still queued past its asker's
|
||||
deadline without touching the engine and without remembering it, so its broadcast copy (which the peer also received —
|
||||
the asker had reported OutcomeUnknown) is what applies; late work cannot pile up behind a stalled store.
|
||||
Measured through one host with the production LocalDb store (`ScriptedAlarmCommandThroughputTests`): 300 sequential
|
||||
acks in 59 ms (max 11 ms each); 300 AddComments with 64 outstanding at once in 49 ms (max 24 ms each).
|
||||
|
||||
@@ -459,6 +466,15 @@ broadcast, so no engine anywhere applied it and the revert plus the definite fai
|
||||
gRPC-data `CallConditionMethod` on a scripted condition carries the same verdict (`ExecuteConditionMethodAsync`): applied ⇒
|
||||
`DriverConfirmedSuccess`, refused after dispatch ⇒ `DriverConfirmedFailure`, no answer ⇒ `OutcomeUnknown`.
|
||||
|
||||
**Behaviour change (review r2 L5).** A scripted method is now REFUSED (`BadInvalidState`), reverted, and NOT broadcast to
|
||||
the redundant peer when this node has no scripted-alarm host (no condition-state store, or the host not yet spawned) or the
|
||||
host does not own the alarm — including the window after a host supervision restart before its configuration is re-sent.
|
||||
Before #937 such a call returned Good and the broadcast let the peer apply it.
|
||||
|
||||
**Revert guard.** A refusal reverts the node only when its per-condition mutation counter (bumped by every projection,
|
||||
every reported condition event and every accepted method) is unchanged since the method — a field comparison missed a
|
||||
Timed→Timed re-shelve or a ClientUserId change. The captured raw severity is restored as captured.
|
||||
|
||||
**Residual.** Only the pre-check stops the SDK from applying the node change, so a refusal that arrives through the ask
|
||||
shows subscribers two events: the method's, then the corrective one. An OutcomeUnknown leaves the node changed (the engine
|
||||
may still apply it). A command racing the engine's first load queues behind it rather than failing.
|
||||
|
||||
Reference in New Issue
Block a user