Skip to content

fix: keep ConfigureAwait(options) validation frame in controlled awaitables - #80

Merged
ReubenBond merged 1 commit into
mainfrom
rb-fix-rethrown-stack-trace-oracle
Nov 23, 2026
Merged

ReubenBond merged 1 commit into
mainfrom
rb-fix-rethrown-stack-trace-oracle

Conversation

@ReubenBond

@ReubenBond ReubenBond commented Nov 23, 2026 •

Copy link
Copy Markdown
Owner

Agent assessment

Self-reported assessment, not an independent review.

Assessed revision: f2dbc6c30037e17e339d0b045a6a762c396af380

Dimension Assessment Rationale
Change confidence 9.5/10 Conformance suite passes locally Release/Debug, parallel and sequential, and Release sequential under TieredCompilation=0 (1507/1507 each); CI green including the new sequential TC=0 awaiter step (49/49). Earlier CI attempts failed only in RaceTrackerMemoryTests (#69).
Diagnosis confidence 9.5/10 Under TieredCompilation=0 the four Reject cases fail deterministically without the fix and pass with it; the missing frame is ConfigureAwait inlined into the hidden ctor.
Evidence fit 8.5/10 Explains the issue's trace (BCL ConfigureAwait frame absent from the controlled trace after a long sequential run tiers the ctor up); the issue's run was not reproduced with default tiering on this machine.

Root cause

ControlledConfiguredTaskAwaitable(Task, ConfigureAwaitOptions) and its generic counterpart are [StackTraceHidden] and validate options by calling the BCL's ConfigureAwait(options). Once the JIT optimizes these constructors (Tier1 after enough calls in a long sequential run, or DOTNET_TieredCompilation=0), it inlines ConfigureAwait into the hidden frame, so the BCL's ConfigureAwait frame disappears from the ArgumentOutOfRangeException trace. The BCL oracle's probe runs once per fresh assembly at Tier0, so it always keeps the frame — hence the order dependence.

Fix

  • The two constructors are NoInlining | NoOptimization, so the BCL call stays a real frame: invalid options throw from the BCL's ConfigureAwait frame, as from a non-inlined call, in every tier.
  • The awaiter conformance probe disables JIT optimization (DebuggableAttribute), so the BCL oracle also has the frames of a non-inlined call when the probe itself is optimized (TC=0).
  • CI runs ControlledAwaiterConformanceTests sequentially in Release without tiered compilation, which reproduces the failure deterministically without the fix (4 failures) and passes with it.
  • docs/compatibility.md states the frame contract.

Validation

  • dotnet run --project tests/Clockwork.Conformance.Tests/... -c Release|Debug --no-build -- --parallel collections|none: 1507/1507 in all four.
  • DOTNET_TieredCompilation=0 DOTNET_ReadyToRun=0 ... -c Release|Debug -- --parallel none --filter-class *ControlledAwaiterConformanceTests: 49/49; 45/49 (4 Reject cases fail) with the source fix reverted.

Fixes #79

…tables

The controlled ConfigureAwait(ConfigureAwaitOptions) awaitable constructors are
[StackTraceHidden] and validate through the BCL's ConfigureAwait. Once the JIT
optimizes them (Tier1 in a long sequential run, or TieredCompilation=0), it
inlines ConfigureAwait into the hidden frame, so the BCL's frame disappears from
the trace of invalid options. NoInlining | NoOptimization keeps the BCL call a
real frame.

The awaiter conformance probe disables JIT optimization so the BCL oracle has
the frames of a non-inlined call in every run, and CI runs the awaiter
conformance class sequentially without tiered compilation.

Fixes #79
@ReubenBond
ReubenBond merged commit 89c8e83 into main Nov 23, 2026
13 of 16 checks passed
ReubenBond added a commit to ReubenBond/orleans that referenced this pull request Nov 23, 2026
…cts its options

Port of ReubenBond/Clockwork@f2dbc6c
(ReubenBond/Clockwork#80, fixing ReubenBond/Clockwork#79).

The controlled ConfigureAwait(ConfigureAwaitOptions) awaitables validate
their options by calling the BCL's ConfigureAwait from [StackTraceHidden]
constructors. Once the JIT optimized a constructor, through tiering in a long
run or with tiered compilation off, it inlined the BCL call into the hidden
frame, so an invalid option's ArgumentOutOfRangeException lost the BCL's
ConfigureAwait frame which an uninstrumented call shows. Both constructors are
now NoInlining and NoOptimization. The conformance probe compiles without
optimization, so the BCL side of the comparison keeps the frames of a
non-inlined call in every run, and the compatibility notes record the frame.

The Simulation packaging and lowering CI job gains upstream's regression lane:
ControlledAwaiterConformanceTests in Release with --parallel none and tiered
compilation and ReadyToRun off, which fails four cases without the fix.

The simulation suites ran with collection-level parallelism through their own
testconfig.json, because this oracle failed under sequential order. Every
simulation suite now passes sequentially, so they take Orleans' sequential
test configuration; sequential order is what exposed this divergence. The
suites keep workstation garbage collection for their heap oracles.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RethrownExceptionStackTraceMatchesTheBclAwaiter fails when the conformance suite runs sequentially

1 participant