Repository navigation
#738 Stop the race harness calling slowness a hang, and leaking a locked database that poisons the next run - #746
Merged
Merged
Conversation
…ked database that poisons the next run OlcBTreeRaceStressTests recorded "HANG" when iterTask.Wait(IterationDeadline) expired. That is a ten-second wall clock, not a detected deadlock, and a bounded-but-glacial iteration trips it identically to a stuck one: the pessimistic paths allow MaxPessimisticRestarts of 10,000, measured at 2m34s single-threaded in #740, against a scenario body running under ProcessorCount/2 CPU-saturating noise threads. Reading that label as evidence of a lock cycle is what sent five hypotheses in #738 to be refuted one at a time, each looking for something that was never there. It is DEADLINE now, and the comment at the site says what it does and does not establish, and that the answer is in the stacks rather than in this counter. The deadline path deliberately skipped cleanup and leaked the ManagedPagedMMF with its file still open, reasoning that orphan workers may be alive and that the leak is bounded by the stress duration. It is not bounded by the stress duration. A testhost.exe from a completed run stayed alive holding the test DLL, and had to be killed by pid before a rebuild could copy over it. Because _scenarioId restarts at 0 in every test host, olcrs_{id:x} was unique within a process and identical across processes, so a leaked lock sat exactly where the next run would ask for it. EnsureFileDeleted cannot remove a file another process holds, and LoadFile throws. Three consecutive isolated runs failed identically at olcrs_2397, and 33,088 leaked database directories had accumulated under the test bin. Including the process id makes the leak self-contained instead of contagious. The fixture also carried no NonParallelizable while its sibling OlcBTreeStressTests does, so a harness that already spawns five scenario tasks plus its noise threads ran as one of four concurrent heavy fixtures under the assembly's LevelOfParallelism(4). That configuration took the test host down, with ChaosStressTests.UltimateStress_AllSubsystems, SubscriptionStressTests.MultiClient_50Clients_SharedView_AllReceiveDeltas and WalCrashSweepTests.Exhaustive_PageAxis_SingleTxSpawn_N33 in flight alongside it. On the repaired harness: six runs, 68,123 iterations, no hangs, no crashes, and no missing keys in any scenario. Read no rate published before this change as a property of the tree. What the working instrument then showed, recorded here because it is what the next step builds on. #738 is not a deadlock: raise OLC_STRESS_ITER_DEADLINE_SECONDS to 300 and the deadlines disappear entirely, replaced by both Add scenarios reaching the MaxPessimisticRestarts bound and throwing "no progress in 10000 pessimistic retries" out of AddOrUpdateCorePessimistic. Same event, two labels. It is the same defect class as #740 and a different instance, since the Add scenarios never call Remove. #739's chunk id reproduces in Remove_Disjoint rather than Remove_Merges, at a stable ChunkId=589824 across separate runs, which is 0x90000 and so a packed field read as a chunk id rather than corruption.
This was referenced Aug 10, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Repairs the OLC race-stress harness, which had been the primary evidence source for
#297/#679/#738/#739while carrying four defects that produce the same signal as a tree bug. Addresses#738; deliberately not auto-closed — the tree-side defect it uncovered is still open.Independent of #745; no file overlap, either order merges.
What was wrong with the instrument
1. "HANG" was a ten-second wall clock, not a detected deadlock.
RunScenarioLooprecords it wheniterTask.Wait(IterationDeadline)expires — default 10 s, against a scenario body running underProcessorCount/2CPU-saturating noise threads plus four other scenario loops. A bounded-but-glacial iteration trips it identically to a stuck one, and the pessimistic paths allowMaxPessimisticRestarts = 10,000, measured at 2 m 34 s single-threaded in #740.Reading that label as evidence of a lock cycle is what sent five hypotheses in #738 to be refuted one at a time — each looking for something that was never there. Relabelled
DEADLINE, with the distinction stated at the site and a pointer to capture stacks rather than infer.2. The deadline path leaked the database, by design. Its own comment: "Skip cleanup; let the orphan workers churn... Memory leak across HANG iters is bounded by the stress duration." It is not bounded by the stress duration — a
testhost.exefrom a completed run stayed alive holding the test DLL and had to be killed by PID before a rebuild could copy over it.3. So one deadline poisoned every later run, deterministically.
_scenarioIdrestarts at 0 in each test host and the name wasolcrs_{id:x}— unique within a process, identical across them. A leaked lock therefore sat exactly where the next run would ask for it;EnsureFileDeletedcannot remove a file another process holds, andLoadFilethrows.Measured: three consecutive isolated runs failed identically at
olcrs_2397, and 33,088 leakedolcrs_*.typhondirectories had accumulated under the test bin. Nowolcrs_{ProcessId:x}_{id:x}— the leak becomes self-contained instead of contagious.4. The fixture was never
[NonParallelizable]. The assembly runsParallelizable(ParallelScope.Fixtures)atLevelOfParallelism(4).OlcBTreeStressTestscarries the attribute; this one did not — so a harness already spawning five scenario tasks plus ~16 noise threads ran as one of four concurrent heavy fixtures. That configuration took the test host down, withChaosStressTests.UltimateStress_AllSubsystems,SubscriptionStressTests.MultiClient_50Clients_SharedView_AllReceiveDeltasandWalCrashSweepTests.Exhaustive_PageAxis_SingleTxSpawn_N33in flight alongside it.What a working instrument then showed
Six runs, 68,123 iterations: no hangs, no crashes, no missing keys in any scenario.
Add_SplitsAdd_DisjointRemove_DisjointRemove_MergesRemove_MixedRead no rate published before this change as a property of the tree.
#738 is not a deadlock
The experiment that settles it — same build, same 60 s of stress, only the iteration deadline changes. If the iteration is stuck, no budget helps; if it is merely slow, a bigger budget lets it finish.
DEADLINErecordsAt 300 s the deadlines vanish and are replaced by both
Add_*scenarios reaching the bound and throwing:Same event, two labels. It is the same defect class as #740 and a different instance — the
Add_*scenarios never callRemove, and the #740 fix was already in that build. Left open: which restart in the pessimistic insert fails to make progress. The instrumentation shape that worked on the Remove side is per-exit counters, so a burn names its exit instead of leaving it to inference.#739 reproduces, and it is not garbage
Remove_Disjoint(notRemove_Merges), inRemoveLeaf's merge-from-right branch:Identical
ChunkIdand page index across two independent runs.589824is0x90000— low 16 bits zero, the shape of a packed field read as a chunk id, not of corrupted memory.Scope
Test-fixture changes only; no engine code. Build verified standalone. Companion doc correction in
typhon-claude.