OpcUaClient: stale BadNoSubscription after a normal resubscribe is declared subscription loss (ConnectionLost) #763
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?
OpcUaClientDriver.HandlePublishError(~line 3347) treats anyBadNoSubscriptionas loss of a tracked subscription:trackedis true whenever any subscription exists, so a lateBadNoSubscription(0x80790000, subscriptionId=0) belonging to a subscription the driver itself just deleted triggersDeclareSubscriptionLost→ BadNoCommunication quality annotation on alarms +ConnectionLost. In production a routine unsubscribe→resubscribe can therefore make the host re-initialise the driver.Found as the root cause of #728 (ConditionRefresh wire test, reproduced 5/6 locally). Fix options: ignore BadNoSubscription for a short grace window after the last tracked subscription is deleted, or verify a tracked subscription id is actually gone before declaring loss. Land with #728's test diagnostics (record message/severity/quality/AlarmType).
Fixed on master
0217d36c. A BadNoSubscription naming a subscription id now counts only if the id is tracked (same rule as BadSubscriptionIdInvalid). An anonymous (id 0) BadNoSubscription withinStaleNoSubscriptionGrace(5 s) of a delete that left the driver tracking nothing is ignored (Debug log); window stamped on removal and restarted when the delete completes, also stamped by failed-subscribe cleanup, reset on session release; a delete that leaves another subscription tracked opens no window. Genuine loss inside the window is still caught by the publishing-stall heuristic (only the immediate ConnectionLost is forgone). Documented in docs/drivers/OpcUaClient.md.Evidence: new OpcUaClientStaleNoSubscriptionTests (7) — 3 stale-error cases fail with the old HandlePublishError; 4 genuine-loss controls pass both ways; mutation-checked (window on any delete / never expiring / no session reset each fail a test). OpcUaClient driver tests 293/293, OpcUaServer.IntegrationTests 127/127, driver integration 5/5.