DriverInstanceActor: in-place ApplyDelta while Connected leaves stale subscription handles #663
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Follow-up from #662 (review finding 3, deliberately left unfixed there).
Defect (latent).
DriverInstanceActor.HandleApplyDeltaAsync(Connected state) callsIDriver.ReinitializeAsyncand changes nothing else. Every driver's reinit releases its device/session state (#630), so the driver-side data and native-alarm subscriptions are gone — but the actor keeps_subscriptionHandle/_alarmSubscriptionHandle.ReconcileSubscription/ReconcileAlarmSubscriptionsee non-null handles and never re-subscribe, so every tag and alarm on that driver goes silent until a reconnect or respawn.Reachability. Not reachable from deploys today: since #516 a DriverConfig change is stop + respawn, so
DriverHostActor.ApplyChildDeltais never called on the reconcile path. The Connecting/ReconnectingApplyDelta(AdoptConfigDuringInit) is fine — handles are already detached there.Proposed fix. Route a Connected
ApplyDeltathrough the existing reconnect path (same asForceReconnect):DetachSubscription(), adopt the new config,Become(Reconnecting), init with the new config; the Connected entry then re-subscribes data + alarms fresh. Ack semantics matchAdoptConfigDuringInit(acked on adoption).Tests. ApplyDelta to a Connected driver ⇒ fresh data + alarm subscriptions and an alarm still reaches its condition; falsified by restoring the old handler.
Fixed on master in
1355049f(merging39c5af3d).Fix. A Connected
ApplyDeltanow:ReinitializeAsync.finally, because a failed reinit has lost them too.Why reinit and not the reconnect path the issue proposed:
CalculationDriverandGalaxyDrivertake their config at construction and ignore the JSON passed toInitializeAsync. Shutdown + initialise would therefore silently not adopt the new config for them. The ack andDeltaAppliedordering are unchanged.Tests.
An_in_place_ApplyDelta_leaves_one_live_data_and_one_live_alarm_subscriptionhas two cases, and each fails against a different wrong fix:The "not two" check waits for three counted reconcile ticks before asserting. Full suite on the merged master: 13216 passed, 0 failed.
Still latent: no deploy reaches this path since #516. Docs:
docs/DriverLifecycle.md,CLAUDE.md. The scadaproj history entry is484b176; ScadaBridge impact is none.