Runtime.Tests: A_definition_replaced_by_a_renewal_never_resolves_as_missing fails ~8% under heavy load (TryResolve gives up after 16 back-to-back replacements) #970
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?
Found while stress-testing #969. Present on master
708a4889c, not caused by #969.GrpcDataConfiguredDiscoveryWireTests.A_definition_replaced_by_a_renewal_never_resolves_as_missing(#968's regression test) fails about 8% of runs under heavy parallel load: 22 of 280 runs, with 14 paralleldotnet testlanes and 14 CPU burners on 14 cores. The rate is the same on master binaries and on the #969 branch. It always fails on the same assertion:a live node resolved as missing N times in ~1M lookups racing ~150k renewals, with N between 1 and 12.Likely cause:
OtOpcUaNodeManager.TryResolve/TryResolveForRenewalre-evaluate a replaced definition at mostMaxProjectedResolveAttempts = 16times. The test's renewer swaps the definition in a tight loop (~100k swaps/s), so a reader that is preempted mid-check can see 16 consecutive replacements and give up, reporting the node missing. Production renewals are seconds apart, so the product impact is theoretical. The test, however, asserts an absolute zero.Options:
Option (a) is preferable if the locked read cannot deadlock with the demand-check callers that the lock-free path exists to protect (they can hold a source gate that SDK publication also needs). That constraint probably makes (b) the safe choice.
Repro: build Runtime.Tests, copy
bin/Debug/net10.0aside, rundotnet test <dll> --filter FullyQualifiedName~A_definition_replacedin 14 parallel loops next to 14 busy loops.Fixed in e4740df2c (merged 440b182f3). The resolve now loops until it gets a stable read, with no 16-retry cap. Each retry needs a completed replacement of this exact node, and commits are serialized, so the loop terminates. A removed node or disposing server still exits immediately. A new deterministic test (64 back-to-back replacements) fails on old master and passes now. Stress: 22/280 -> 0/280.