Merge runtime follow-ups: a retired driver child's late ConnectivityChanged no longer overrules a connected replacement (#1070, race confirmed deterministically), node-manager-only wiring guard for the authorizer delegates (#1079)
This commit is contained in:
@@ -6314,7 +6314,8 @@ public sealed partial class OtOpcUaNodeManager : CustomNodeManager2, INodeManage
|
||||
/// (<see cref="IsProjectedDescendant"/>) only [2]/[3], and <c>AuthorizeIfRequired</c> then takes the
|
||||
/// <c>localBypass</c>. The one wiring where the full path differs — a mapped-subject resolver with no projected
|
||||
/// predicate, which asks the resolver about every node and denies the local ones it cannot place — is excluded, so
|
||||
/// that configuration keeps its existing verdict.
|
||||
/// that configuration keeps its existing verdict. Sound only because this manager is the sole wirer of both delegates,
|
||||
/// to its own methods — pinned by <c>AuthorizerClassifierWiringGuardTests</c> (#1079).
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Measured (10k flag-off items): a pass went from ~6.5–7 ms and ~1.4 MB (the pass-local memo's tuple keys and
|
||||
|
||||
@@ -765,6 +765,12 @@ public sealed partial class DriverHostActor : ReceiveActor, IWithTimers, IWithUn
|
||||
/// <summary>When this child was spawned — the diagnostics' last-change time until it publishes health.</summary>
|
||||
public DateTime SpawnedUtc { get; } = DateTime.UtcNow;
|
||||
|
||||
/// <summary>
|
||||
/// The last connectivity edge THIS incarnation announced (false until its first <c>Connected=true</c>).
|
||||
/// #1070: a stopped predecessor's late Bad edge is dropped once this is true.
|
||||
/// </summary>
|
||||
public bool Connected { get; set; }
|
||||
|
||||
// Convenience accessors for sites that don't need the full spec.
|
||||
/// <summary>Gets the driver type name from the child's spec.</summary>
|
||||
public string DriverType => Spec.DriverType;
|
||||
@@ -2006,8 +2012,9 @@ public sealed partial class DriverHostActor : ReceiveActor, IWithTimers, IWithUn
|
||||
private void ForwardBatchToMux(DriverInstanceActor.AttributeValueBatchPublished msg)
|
||||
{
|
||||
// A burst from an incarnation this host already stopped: forwarding it would undo the SourceRemoved
|
||||
// eviction (see _retiredChildren). Its ConnectivityChanged is NOT filtered — the respawn path relies on
|
||||
// that Bad fan to cover the gap.
|
||||
// eviction (see _retiredChildren). Its ConnectivityChanged is filtered only once the replacement has
|
||||
// connected (#1070, IsStaleRetiredConnectivity) — until then the respawn path relies on that Bad fan to
|
||||
// cover the gap.
|
||||
if (_retiredChildren.Contains(Sender))
|
||||
{
|
||||
_log.Debug("DriverHost {Node}: dropped a {Count}-item value burst from a stopped incarnation of {Id}",
|
||||
@@ -2125,6 +2132,17 @@ public sealed partial class DriverHostActor : ReceiveActor, IWithTimers, IWithUn
|
||||
/// </summary>
|
||||
private void OnDriverConnectivityChanged(DriverInstanceActor.ConnectivityChanged msg)
|
||||
{
|
||||
if (IsStaleRetiredConnectivity(msg))
|
||||
{
|
||||
_log.Debug(
|
||||
"DriverHost {Node}: dropped a stale ConnectivityChanged(connected={Connected}) for {Id} from a stopped incarnation ({Stale})",
|
||||
_localNode, msg.Connected, msg.DriverInstanceId, Sender);
|
||||
return;
|
||||
}
|
||||
|
||||
if (_children.TryGetValue(msg.DriverInstanceId, out var announcing) && Equals(announcing.Actor, Sender))
|
||||
announcing.Connected = msg.Connected;
|
||||
|
||||
if (msg.Connected && _acquisitionDemands.ContainsKey(msg.DriverInstanceId) &&
|
||||
_children.TryGetValue(msg.DriverInstanceId, out var activeChild) && Equals(activeChild.Actor, Sender))
|
||||
SendDesiredSubscriptions(activeChild.Actor, msg.DriverInstanceId);
|
||||
@@ -2178,6 +2196,38 @@ public sealed partial class DriverHostActor : ReceiveActor, IWithTimers, IWithUn
|
||||
_localNode, msg.DriverInstanceId, msg.Connected ? "connected" : "disconnected", annotated, statusCode);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// #1070 — whether <paramref name="msg"/> comes from a child this host already stopped (a
|
||||
/// <see cref="_retiredChildren"/> member) and would overrule the CURRENT incarnation's state.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// <c>Context.Stop</c> is asynchronous and messages from two different children are not ordered, so a
|
||||
/// stopped child's <c>PostStop</c> comms-loss announcement can reach this host AFTER its replacement
|
||||
/// connected and published its initial push — the old child only gets to its stop once whatever it is
|
||||
/// running returns (a synchronous driver call, e.g. a health publish). Applied then, it stamped every value
|
||||
/// node <c>BadNoCommunication</c> with nothing left to re-publish them, re-latched them and cancelled the
|
||||
/// recovery audit the new incarnation had armed: nodes stuck Bad with the tripwire disarmed.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Stale, and dropped whole: any <c>Connected=true</c> from a retired child (it vouches for a connection
|
||||
/// that has been torn down — applied, it would arm an audit and annotate conditions Good for a driver
|
||||
/// that may not be connected yet), and its <c>Connected=false</c> once the current child of the same id
|
||||
/// has announced it is connected. A retired child's Bad edge is still APPLIED while the replacement has
|
||||
/// not connected (or there is none): that is the 03/S15 gap cover an operator Restart and a respawn rely
|
||||
/// on, and the replacement's own push clears it. Same rule the condition-signal tracker already applies
|
||||
/// (<c>OnConditionSignalConnectivity</c>). A sender that was never a child of this host is not filtered.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <param name="msg">The connectivity announcement; <c>Sender</c> is its producer.</param>
|
||||
/// <returns><see langword="true"/> when the message must be dropped.</returns>
|
||||
private bool IsStaleRetiredConnectivity(DriverInstanceActor.ConnectivityChanged msg)
|
||||
{
|
||||
if (!_retiredChildren.Contains(Sender)) return false;
|
||||
if (msg.Connected) return true;
|
||||
return _children.TryGetValue(msg.DriverInstanceId, out var current) && current.Connected;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Archreview <b>03/S15</b> — the value-node half of the comms-loss fan-out: stamp
|
||||
/// <see cref="OpcUaStatus.BadNoCommunication"/> on every raw NodeId <b>and</b> every referencing UNS
|
||||
|
||||
Reference in New Issue
Block a user