fix(dataconn): #1026 name every origin reset cause; stop binding checks invalidating live sources; renew cohort leases in batches
Gate #1026 (2048 projected items, rig seed --scale 2048) still failed after #1115. Three defects, found by first making the origin and the consumer say why: Diagnostics (origin + consumer) - SourceInvalidationReason (bounded enum, classified from the publisher's reason constants): counted per reason (`otopcua.dataconn.source.invalidations{reason}`, `Invalidate.<Reason>` in SourceIngressDiagnostics), recorded on the source and logged at Debug (PartitionedSampleHub.Logger). - An interest lease records why it stopped; the origin Subscribe stream's Reset text names it ("Source invalidated (<reason>).", "Source retired.", "Source interest released.", "Source routing changed.", "Source partition reset.", "Source binding replaced.") instead of always "Source change history expired."; logged at Information (Released at Debug). The texts are for people/counters only: the consumer classifies them into ResetSourceInvalidated / ResetInterestLost (no peer branches on them; the rig probe whitelist is updated). - Consumer: renewal started/succeeded/failed/budget/slot counters, RenewalFail.<point> and AttemptEnd.<reason> (bounded, constant keys). 1. Origin: a binding check invalidated live sources. The driver actor's source-binding retry re-walks every desired reference (offset 0, every <= 30 s once any one failed); for an already-bound reference it took the source's serialization gate, and when the poll thread was publishing that source both sides invalidated it (BindingContention / SerializationContention) and reset every origin stream holding it. Live s1026-c: the only invalidation reasons were those two (5+5 during the open, recurring every ~30 s). EnsureDriverBinding now answers an already-bound, current source without the gate. Live after: 0 BindingContention. 2. Consumer: per-item metadata lease renewal could not keep up. Each projected item renewed its 15 s lease with its own capabilities + GetMetadata pair holding a 256 KiB unary reservation; at the default 1 MiB budget four ran at once and the rest retried on the next 250 ms tick (~16 items/s). Live s1026-d: 155 703 renewals started, 153 019 refused by the unary budget, 2 564 committed; ~1900 of 2048 items stood down BadUserAccessDenied; 0 recovered after the origin restart. RemoteNamespaceResolver.RenewExactBatchAsync renews many items with one capabilities call and one GetMetadata per origin MaxBatchItems (the single-item renewal is now the batch of one: same checks, lease bound and commit); a cohort renews every due item of a tick in batches of 128, and the between-attempt renewal (every item after an origin restart) is batched too. 3. Consumer: two demands of one node in one cohort deadlocked the batch: the second joined (#969) the first's claim, and the batch waited for the joiner before publishing its verdict. The batch now publishes first. Live (OrbStack rig, 160 + 1888 items, 4 Hz churn, SOURCE pair restart): s1026-f run 1 open 10.2 s, recovery 1.5 s, 0 resets of any kind; s1026-h run 2 PASS (open 3.1 s, recovery 3.6 s, 0 resets, no history-expired or source-invalidated log line). Remaining (not fixed here): s1026-h run 1 recovered only 852 of 1888 large-mapping items after the restart: their renewals fail in the catalog cache's predecessor-chain bound (RenewalFail.Cache.PredecessorChain 81 163). Tests: GrpcData1026BindingContentionTests (fails without the fast path), GrpcData1026RenewalBatchWireTests (one tick renews all due items in one metadata call - fails with per-item renewals; two demands of one node - fails without the ordering fix), GrpcData1026ResetReasonTests. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -343,7 +343,10 @@ public static class ProbeEngine
|
||||
"Snapshot admission exhausted; retry later." or "Freshness snapshot admission exhausted; retry later." or
|
||||
"Pending snapshot memory exhausted." or "Pending value memory exhausted." or
|
||||
"Pending value capacity exhausted." or "Pending control capacity exhausted." or
|
||||
"Transport capacity exhausted." => diagnostic,
|
||||
"Transport capacity exhausted." or
|
||||
"Source interest released." or "Source routing changed." or "Source partition reset." or "Source binding replaced." or "Source retired." => diagnostic,
|
||||
// #1026: the suffix is a bounded SourceInvalidationReason name.
|
||||
_ when diagnostic.StartsWith("Source invalidated (", StringComparison.Ordinal) && diagnostic.Length <= 64 => diagnostic,
|
||||
_ when diagnostic.StartsWith("Snapshot pacing; retry after ", StringComparison.Ordinal) => "Snapshot pacing",
|
||||
_ => "Other server control reason",
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user