fix(opcua): #970 a projected lookup racing back-to-back renewals never gives up and reports a live node missing

#968 made OtOpcUaNodeManager.TryResolve/TryResolveForRenewal re-evaluate a
definition replaced mid-check, but at most 16 times. A reader preempted while a
renewer swapped the definition back to back exhausted the bound and answered
'no such node' for a live node, which tears a physical stream down
(A_definition_replaced_by_a_renewal_never_resolves_as_missing failed 22/280
under load, on master too).

The bound is removed; the double read stays (it is what stops a removed node
being answered). The loop provably ends: the committed map compares values by
reference, so a retry happens only when a replacement of THIS node was
committed during that pass. Iterations are at most 1 + the replacements
committed during the call (lock-free progress; commits are serialized under
Lock and each needs a renewal or page apply); a removed node or a disposing
manager ends it at once.

Regression: A_lookup_outlasting_many_back_to_back_replacements_never_resolves_as_missing
(deterministic: the definition's authority check commits a replacement each time
it is evaluated, 64 times in a row; red on master, green now). Stress at the
same load: 280/280 runs of the 5 renewal tests pass (master: 22/280 failed).
This commit is contained in:
Joseph Doherty
2026-12-02 15:36:52 -05:00
parent 59f1eabc87
commit e4740df2c9
3 changed files with 57 additions and 5 deletions
+4 -1
View File
@@ -156,7 +156,10 @@ reads, so a stream racing a renewal could see its live node as gone for an insta
stream down (a freshness check breaking the attempt, or `Source unavailable` on the rebind's baseline).
Two cadences of the same node made it likely, because both renew on the same tick and the second
(redundant) renewal replaces the definition again while the first cadence rebinds. A lookup now
re-evaluates a definition replaced mid-check instead of reporting it missing.
re-evaluates a definition replaced mid-check instead of reporting it missing. Since #970 it does so with no
fixed bound (the first cut gave up after 16 back-to-back replacements, which a preempted reader racing a
fast renewer could hit). It retries only when the node's entry was actually replaced during that pass, so it
ends once replacements stop, and a removed node or a disposing server still ends it at once.
Since #969 cadences of the same node no longer renew it twice: a cadence that reaches the renewal window
while another cadence is already renewing the same predecessor waits for that renewal (one origin