fix(runtime): a removed driver's late writes no longer resurrect its resilience/telemetry state (#609)
DriverHostActor.StopChild released the tracker (Invalidate) and evicted the hub synchronously, but Context.Stop is asynchronous: the stopping child's in-flight SubscribeBulk completed through its capability invoker AFTER the release, and its RecordCallStart/RecordSuccess/RecordCallComplete re-created the tracker entry, which DriverResilienceStatusPublisherService then re-emitted every tick forever. Confirmed with a temporary stack capture in the tracker (removed): every post-Release write came from DriverInstanceActor.HandleSubscribeAsync -> CapabilityInvoker.ExecuteAsync; the test failed whenever it landed before the second publisher tick. - DriverResilienceStatusTracker.Retire (Release) drops the id's snapshots and ignores every later Record* for it; one guarded write path re-checks after the upsert so a write racing Retire cannot survive it. Reinstate (called by DriverCapabilityInvokerFactory.Create) lifts it, so the same id re-added in a later deployment records again. - TelemetryLocalHub.Evict now also holds the id (late Health/Resilience dropped, neither cached nor fanned out); ITelemetryLocalHub.Readmit (default no-op), called at the top of SpawnChild, lifts it. - The removal test is now deterministic: an invoker decorator holds the child's subscribe inside the real invoker's bracket across the removal and signals when its late writes are done (positive control) — red 5/5 without the fix, green 20/20 with it. New unit tests for the tracker guard (incl. a Retire race), the factory Release/Create pair, the hub hold/readmit, and a re-add-same-id host test. Claude-Session: https://claude.ai/code/session_01Ef2ozxS7QPanGT8uoATbTe
This commit is contained in:
@@ -89,6 +89,16 @@ public interface ITelemetryLocalHub
|
||||
/// Drops the cached Health and Resilience snapshots of a driver instance that has been removed from
|
||||
/// this node, so a later <see cref="Subscribe"/> no longer replays its last-known state. Live
|
||||
/// subscribers are not told; the instance simply stops emitting. Unknown ids are a no-op.
|
||||
/// <para>The eviction also <b>holds</b> (#609): a removed instance's child stops asynchronously and can
|
||||
/// still publish after this call (a health snapshot when an in-flight connect or subscribe finishes),
|
||||
/// so until <see cref="Readmit"/> every later Health/Resilience item for the instance is dropped — not
|
||||
/// cached and not fanned out.</para>
|
||||
/// </summary>
|
||||
void Evict(string driverInstanceId);
|
||||
|
||||
/// <summary>
|
||||
/// Lifts an earlier <see cref="Evict"/> so a driver instance spawned again under the same id (a later
|
||||
/// deployment re-adding it) publishes normally. A no-op for an id that was never evicted.
|
||||
/// </summary>
|
||||
void Readmit(string driverInstanceId) { }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user