Skip to content

JIT: Null out exceptions in reused continuations and reenable continuation reuse#125869

Open
jakobbotsch wants to merge 3 commits intodotnet:mainfrom
jakobbotsch:fix-125805
Open

JIT: Null out exceptions in reused continuations and reenable continuation reuse#125869
jakobbotsch wants to merge 3 commits intodotnet:mainfrom
jakobbotsch:fix-125805

Conversation

@jakobbotsch
Copy link
Member

On resumption we use the presence of an exception object as the indicator for whether an exception should be rethrown. With continuation reuse we should take care to reset this exception so that we do not rethrow the same exception on a future resumption.

Fix #125805
Fix #125806

On resumption we use the presence of an exception object as the
indicator for whether an exception should be rethrown. With continuation
reuse we should take care to reset this exception so that we do not
rethrow the same exception on a future resumption.
Copilot AI review requested due to automatic review settings March 20, 2026 21:53
@github-actions github-actions bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Mar 20, 2026
@jakobbotsch
Copy link
Member Author

/azp run runtime-coreclr libraries-jitstress

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates async continuation reuse behavior to avoid rethrowing stale exceptions when a continuation instance is reused, and adds a regression test for the scenario.

Changes:

  • Add regression test covering exception reuse across multiple awaits.
  • Clear the stored exception field in the continuation when reuse is enabled.
  • Introduce a method-hash-range gate for continuation reuse (debug-only), and change the default for reuse.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
src/tests/async/regression/125805.csproj Adds a new IL test project for the regression case.
src/tests/async/regression/125805.cs Adds a regression test exercising exception then non-exception resumption.
src/coreclr/jit/jitconfigvalues.h Adds a range config for reuse and changes the default reuse setting.
src/coreclr/jit/async.cpp Clears exception field on resumption when reuse is enabled; adds debug range gating.

@jakobbotsch jakobbotsch changed the title JIT: Null out exceptions in reused continuations JIT: Null out exceptions in reused continuations and reenable continuation reuse Mar 20, 2026
@jakobbotsch
Copy link
Member Author

All libraries tests passed except for one failure that looks like #125295

@jakobbotsch jakobbotsch marked this pull request as ready for review March 21, 2026 11:51
Copilot AI review requested due to automatic review settings March 21, 2026 11:51
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI runtime-async

Projects

None yet

2 participants