ReadBulk snapshot teardown unadvises/removes the client's own subscription for uncached tags #238
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?
MxAccessSession.ReadBulk(src/ZB.MOM.WW.MxGateway.Worker/MxAccess/MxAccessSession.cs, ~956–1231) can silently tear down a subscription the client already holds.Mechanism
TryGetCachedReadFor).OnDataChangehasn't been cached yet, or a tag that is added but not advised, goes to the snapshot path:AddItemon the same address returns the client's existing item handle (MXAccess returns the existing handle for an already-added address; asserted inWorkerLiveMxAccessSmokeTests.cs:557);Adviseruns on that handle and the path waits;TearDownSnapshotsthen callsUnAdviseandRemoveItemon it, deleting the client's own item and advice with nothing logged.Impact (suspected): ScadaBridge subscribes to 810 tags and then immediately seed-reads them in 250-tag
ReadBulkchunks on every reconnect. Any tag not yet cached at that moment loses its subscription. On wonder-app-vd03 the gateway event rate fell from ~355/s to ~240/s at the 2026-11-21 R1/R2 deploy (docs/deploy/2026-11-21-vd03-perf-r1-r2.md), with the source load unchanged per the Historian. The faster event path in the new build likely leaves more tags uncached when the seed read runs. The bug is present in the old build too.Fix: ReadBulk must never
UnAdviseorRemoveItema handle that existed before its own snapshotAddItem. For an already-advised tag with no cached value, wait on the existing subscription instead. Add regression tests and a windev live repro. Then redeploy to vd03 and confirm the rate is back to ~355/s.Related: #236.
Fixed on
fix/238-readbulk-teardown(pushed, not merged):7a41d9ed,13e9a26d,2e6645ef,cc33b063.gateway.md,docs/Contracts.md,docs/DesignDecisions.mdanddocs/MxAccessWorkerInstanceDesign.mdupdated.Tests:
ReadBulkOfClientHeldTagpasses on windev.But the mechanism didn't reproduce on windev. MXAccess returned a new handle for the re-added address, and the old worker left the client's advice intact. So this fix is defensive and probably not the vd03 355→240/s cause. That investigation moves to #239. The Rust worker divergences are filed as #240.
Closing. Merging to
mainis still pending.Note from the 2026-12-02 review (MXA-006): this is closed but the fix (
89e38a1c) is only onfix/readbulk-subscription-teardown, not merged tomainat54367e74. Landing it is part of #252.Reopened 2026-12-03 (decision D5): the fix
89e38a1cis not onmain. Close this when Phase 1 (#252) merges.Merged to
mainat68043411(pushed 2026-12-03). Gateway suite 1610 passed / 0 failed (macOS); windev worker CI 836 passed / 0 failed on that SHA.The fix (
e934854aafter rebase) landed with Phase 1 (#252), per D5.