fix(grpc-data): H3 review round 3 nits b/c/d — no origin cursor stranded on Bad, scope moves or a serve-time throw
- b: ProjectedHistoryAccess releases the prior origin cursor on any Bad answer to a resumed node (and on a mismatched answer) — an unsent refusal left it open at the origin; idempotent. - c: DataConnectionDeploymentLease, when its scope moves while a history answer is in flight, releases the dropped answer's new continuations (best effort); resumed items are BadContinuationPointInvalid, fresh ones BadNoCommunication. - d: ProjectedHistoryRead: a throw while serving outcome i (FromClr on an unconvertible value, a store fault) releases outcome i's cursor unless the store already owns it, and every later outcome's. Each red on revert (mutation).
This commit is contained in:
@@ -198,16 +198,34 @@ public sealed partial class OtOpcUaNodeManager
|
||||
return;
|
||||
}
|
||||
|
||||
for (var i = 0; i < pending.Count; i++)
|
||||
var done = 0; // outcomes [0, done) are fully handed over (a continuation saved to the store, or released)
|
||||
ProjectedHistoryContinuation? handedOver = null; // outcome `done`'s continuation once the store owns it (or released it)
|
||||
try
|
||||
{
|
||||
for (var i = 0; i < pending.Count; i++)
|
||||
{
|
||||
handedOver = null;
|
||||
ServeProjectedOutcome(pending[i].Handle, outcomes[i]);
|
||||
done = i + 1;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// H3 review round 3 nit (d): a throw for outcome i (FromClr on an unconvertible value, a store fault) strands no
|
||||
// origin cursor: outcome i's — unless the store already owns it — and every later outcome's are released.
|
||||
for (var j = done; j < outcomes.Count; j++)
|
||||
if (outcomes[j].Continuation is { } c && !ReferenceEquals(c, handedOver)) c.Release();
|
||||
throw;
|
||||
}
|
||||
|
||||
void ServeProjectedOutcome(NodeHandle handle, ProjectedHistoryOutcome outcome)
|
||||
{
|
||||
var handle = pending[i].Handle;
|
||||
var outcome = outcomes[i];
|
||||
var status = new StatusCode(outcome.StatusCode);
|
||||
if (StatusCode.IsBad(status))
|
||||
{
|
||||
outcome.Continuation?.Release();
|
||||
SetProjectedStatus(handle, results, errors, status);
|
||||
continue;
|
||||
return;
|
||||
}
|
||||
|
||||
byte[]? cp = null;
|
||||
@@ -215,6 +233,7 @@ public sealed partial class OtOpcUaNodeManager
|
||||
{
|
||||
var key = MapKey(handle.NodeId);
|
||||
cp = SaveRemoteContinuation(session, store, key.Realm, key.Id, HistoryBindingTag(handle.NodeId), epoch, next);
|
||||
handedOver = next; // saved (store-owned) or already released by SaveRemoteContinuation
|
||||
}
|
||||
|
||||
var values = new List<DataValue>(outcome.Samples.Count);
|
||||
|
||||
Reference in New Issue
Block a user