fix(worker): leave added-only caller items to a snapshot AddItem (#238)
ci / windows-x86 (push) Successful in 2m4s
ci / java (push) Failing after 6m50s
ci / portable (push) Failing after 9m33s
ci / windows-x86 (push) Successful in 2m4s
ci / java (push) Failing after 6m50s
ci / portable (push) Failing after 9m33s
The live run on windev showed MXAccess hands a re-added address a new handle, so reading a caller's added-but-not-advised item through the caller's handle (temporary Advise/UnAdvise) touched the caller's item for no reason. Only an advised-but-uncached caller tag now reuses the caller's handle (waiting on its existing subscription). Every other tag takes a snapshot AddItem; if that AddItem returns a handle the registry already tracks, it is still treated as the caller's item and never removed. Docs and tests updated to the live observation; the live test now logs the snapshot handle MXAccess returned for the re-added address.
This commit is contained in:
+18
-16
@@ -534,19 +534,21 @@ choices were considered:
|
||||
(`was_cached = false`) and leaves the session exactly as it was before
|
||||
the call. "Exactly as it was" is enforced by ownership, not by
|
||||
symmetry: teardown undoes only the `AddItem` and `Advise` calls the read
|
||||
itself made. A tag the session already holds is read through the
|
||||
caller's item handle with no `AddItem` — an advised tag whose first
|
||||
`OnDataChange` is not cached yet is waited on through the caller's
|
||||
subscription, and an added-but-not-advised tag is advised for the read
|
||||
and unadvised afterwards, which returns it to the caller's prior state;
|
||||
neither is ever removed. Re-adding the caller's address instead returns
|
||||
the caller's own handle from MXAccess, and the old symmetric teardown
|
||||
then unadvised and removed the caller's item — a subscription that
|
||||
delivered one value and went silent (#238). A snapshot `AddItem` that
|
||||
still returns a handle the registry already tracks (an address spelled
|
||||
differently from the caller's) is never removed either; at worst that
|
||||
leaves one extra `AddItem` reference until the caller removes the item
|
||||
or unregisters, which is preferable to deleting a live subscription. The cache lives on a per-session `MxAccessValueCache`,
|
||||
itself made (#238). An advised tag whose first `OnDataChange` is not
|
||||
cached yet is read by waiting on the caller's own subscription, with no
|
||||
`AddItem` at all. Any other tag gets a snapshot `AddItem`. The installed
|
||||
MXAccess on windev hands a re-added address a new handle (observed
|
||||
2026-12-01), so a caller's added-but-not-advised item is not touched and
|
||||
the snapshot item is torn down on its own. The worker does not rely on
|
||||
that: when the snapshot `AddItem` returns a handle the registry already
|
||||
tracks, the handle is the caller's, and a symmetric teardown would
|
||||
unadvise and remove the caller's item — a subscription that delivered
|
||||
one value and went silent. Such a handle is advised for the read only
|
||||
if nothing advises it yet, unadvised afterwards (back to the caller's
|
||||
added-not-advised state), and never removed; at worst one extra
|
||||
`AddItem` reference outlives the read until the caller removes the item
|
||||
or unregisters, which is preferable to deleting a live subscription.
|
||||
The cache lives on a per-session `MxAccessValueCache`,
|
||||
populated by `MxAccessBaseEventSink` on every `OnDataChange` after the
|
||||
event clears the outbound queue.
|
||||
|
||||
@@ -562,9 +564,9 @@ The decision intentionally does NOT synthesize an `OnDataChange` event
|
||||
from the snapshot path: the worker adds no event of its own for the
|
||||
snapshot value, which reaches the caller through `ReadBulk`'s reply
|
||||
payload. The native `OnDataChange` MXAccess raises for a handle the read
|
||||
advised still flows through the event sink like any other — including,
|
||||
for an added-but-not-advised caller item, under the caller's own item
|
||||
handle while the read holds it advised. This preserves the "Don't
|
||||
advised still flows through the event sink like any other (under the
|
||||
snapshot item handle, or under the caller's own handle in the fallback
|
||||
above where `AddItem` returned it). This preserves the "Don't
|
||||
synthesize events" rule that scopes the rest of the worker.
|
||||
|
||||
`ReadBulk`'s wait loop pumps Windows messages on the worker STA
|
||||
|
||||
Reference in New Issue
Block a user