Merge #1109 flake: respawn/restart dependent gap was a real race (#1070 stale-connectivity drop vs #1041's PostStop Bad) — host now tells dependents BadNoCommunication directly at child stop/restart; deterministic regression test
This commit is contained in:
@@ -5101,6 +5101,7 @@ public sealed partial class DriverHostActor : ReceiveActor, IWithTimers, IWithUn
|
||||
WithdrawDriverConditionsKnown(driverInstanceId);
|
||||
ForgetConditionSignals(driverInstanceId);
|
||||
PublishAckPreflight();
|
||||
TellDependentsDriverObjectEnded(driverInstanceId);
|
||||
EvictRetainedValues(driverInstanceId);
|
||||
// The instance left the plan (StopChild is only reached via plan.ToStop), so its cached
|
||||
// Health/Resilience snapshots must not replay to new telemetry subscribers. Release the shared
|
||||
@@ -5146,6 +5147,34 @@ public sealed partial class DriverHostActor : ReceiveActor, IWithTimers, IWithUn
|
||||
private void EvictRetainedValues(string driverInstanceId) =>
|
||||
_dependencyMux?.Tell(new DependencyMuxActor.SourceRemoved(driverInstanceId));
|
||||
|
||||
/// <summary>
|
||||
/// Gitea #1109 — hands every dependent of <paramref name="driverInstanceId"/>'s value refs
|
||||
/// <see cref="OpcUaStatus.BadNoCommunication"/> the moment the host ends the driver OBJECT (config-change
|
||||
/// respawn, operator Restart, deploy removal), so no dependent keeps computing from the stopped object's last
|
||||
/// Good until the replacement publishes.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// This gap used to be covered only by the stopped child's own <c>PostStop</c>
|
||||
/// <c>ConnectivityChanged(false)</c> (#1041). That announcement races the replacement: <c>Context.Stop</c> is
|
||||
/// asynchronous, two children's messages are not ordered, and a child busy in a synchronous driver call (or
|
||||
/// a loaded dispatcher) reaches its stop late. Once the replacement has connected, #1070 rightly drops the
|
||||
/// late announcement (<see cref="IsStaleRetiredConnectivity"/>) — which left dependents on the old Good,
|
||||
/// indefinitely for an on-change source that never republishes an unchanged value. Sent HERE, on the
|
||||
/// host→mux pair the new incarnation's values also travel, it is ordered ahead of every one of them.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Mux only, deliberately: the external value nodes keep the #1070 rule (the retired child's Bad edge is
|
||||
/// applied only while the replacement has not connected) — stamping them here would also latch them for
|
||||
/// the comms-recovery audit. Sent BEFORE <see cref="EvictRetainedValues"/> so the Bad it retains is
|
||||
/// evicted with the old object's values and never replayed. Not sent on a supervision restart (same
|
||||
/// driver object). For a deploy removal it precedes the apply's <c>RemovedInputStatus</c>; a duplicate
|
||||
/// Bad from the old child's <c>PostStop</c> is absorbed by the (value, status) dedup downstream.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
/// <param name="driverInstanceId">The driver instance whose object ended.</param>
|
||||
private void TellDependentsDriverObjectEnded(string driverInstanceId) => FanCommsLossToDependencyMux(driverInstanceId);
|
||||
|
||||
/// <summary>Marks a child this host is about to stop as retired and watches it until it terminates.</summary>
|
||||
/// <param name="child">The child being stopped.</param>
|
||||
private void RetireChild(IActorRef child)
|
||||
@@ -5247,7 +5276,8 @@ public sealed partial class DriverHostActor : ReceiveActor, IWithTimers, IWithUn
|
||||
Context.Stop(entry.Actor);
|
||||
_children.Remove(msg.DriverInstanceId);
|
||||
// An operator Restart builds a NEW driver object, so the old one's retained values are evicted like a
|
||||
// removal's; the respawned driver republishes its own.
|
||||
// removal's; the respawned driver republishes its own. Dependents are told first (#1109).
|
||||
TellDependentsDriverObjectEnded(msg.DriverInstanceId);
|
||||
EvictRetainedValues(msg.DriverInstanceId);
|
||||
// The old incarnation's health must not read as the new one's until it publishes its own.
|
||||
_healthPublisher.Forget(msg.DriverInstanceId);
|
||||
|
||||
Reference in New Issue
Block a user