fix(worker): ReadBulk never tears down a caller's item or subscription (#238)
ReadBulk sent every advised-but-uncached and added-but-not-advised tag down the snapshot path. MXAccess returns the caller's existing handle for a re-added address, so the snapshot's AddItem/Advise ran on the caller's own item and the symmetric teardown then UnAdvised and RemoveItem'd it: the subscription delivered one value and went silent. Teardown is now ownership-scoped: it unadvises only advices the read's own Advise created and removes only items the read's own AddItem created. A tag the session already holds is read through the caller's handle with no AddItem: advised-but-uncached waits on the existing subscription with no COM call; added-but-not-advised is advised for the read and unadvised afterwards (back to its prior state), never removed. A snapshot AddItem that returns a handle the registry already tracks (differently spelled address) is treated as the caller's item and never removed. Adds MxAccessSessionTests regressions; updates gateway.md, Contracts, DesignDecisions, MxAccessWorkerInstanceDesign.
This commit is contained in:
+12
-4
@@ -570,11 +570,19 @@ returns one result per requested entry — per-entry failures populate
|
||||
last cached `OnDataChange` payload when the requested tag is already
|
||||
advised (`was_cached = true`, no subscription side-effects), or by
|
||||
taking a full `AddItem` + `Advise` + wait-for-first-OnDataChange +
|
||||
`UnAdvise` + `RemoveItem` snapshot lifecycle when no live subscription
|
||||
exists (`was_cached = false`). `timeout_ms` is one shared deadline for
|
||||
`UnAdvise` + `RemoveItem` snapshot lifecycle when the session holds no
|
||||
item for the tag (`was_cached = false`). A tag the session already holds
|
||||
is read through the caller's own item handle and is never re-added or
|
||||
removed: advised but not yet cached, the worker waits on the caller's
|
||||
subscription with no COM call; added but not advised, it advises the
|
||||
item for the read and unadvises it afterwards, returning it to the
|
||||
caller's prior added-not-advised state (both `was_cached = false`).
|
||||
Teardown only undoes the `AddItem` and `Advise` calls the read itself
|
||||
made, so a seed read issued right after subscribing cannot cancel the
|
||||
subscription (#238). `timeout_ms` is one shared deadline for
|
||||
the whole command, not a per-tag budget: the worker adds and advises
|
||||
every uncached tag first, waits once for all of them, then tears them
|
||||
all down, so the STA is held for at most one `timeout_ms` (plus the
|
||||
every tag that needs it first, waits once for all of them, then tears
|
||||
down its own snapshot state, so the STA is held for at most one `timeout_ms` (plus the
|
||||
add/advise and teardown COM calls, during which it pumps every 16 tags).
|
||||
Each tag that has not delivered by the deadline surfaces its own
|
||||
`was_successful = false` timeout rather than throwing. Duplicate
|
||||
|
||||
Reference in New Issue
Block a user