Skip to content

Fix gc hole when resuming async continuation via interpreter#127072

Open
BrzVlad wants to merge 1 commit intodotnet:mainfrom
BrzVlad:fix-clrinterp-async-gc2
Open

Fix gc hole when resuming async continuation via interpreter#127072
BrzVlad wants to merge 1 commit intodotnet:mainfrom
BrzVlad:fix-clrinterp-async-gc2

Conversation

@BrzVlad
Copy link
Copy Markdown
Member

@BrzVlad BrzVlad commented Apr 17, 2026

AsyncHelpers_ResumeInterpreterContinuationWorker receives an interior pointer that was not reported to the GC. It seems like this issue was happening only in InterpMode=1. It is likely that in full interpreter mode, the continuation object was conservatively pinned by chance from the interpreter stack.

Fixes random crashes in objects-captured runtime test.

AsyncHelpers_ResumeInterpreterContinuationWorker receives an interior pointer that was not reported to the GC. It seems like this issue was happening only in InterpMode=1. It is likely that in full interpreter mode, the continuation object was conservatively pinned by chance from the interpreter stack.

Fixes random crashes in objects-captured runtime test.
@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @BrzVlad, @janvorli, @kg
See info in area-owners.md if you want to be subscribed.

Copy link
Copy Markdown
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

Fixes a GC reporting hole when resuming async continuations in the interpreter by ensuring an interior pointer passed from managed code is reported and updated across GC during execution (addressing random crashes seen in the objects-captured runtime test, primarily in InterpMode=1).

Changes:

  • Protect resultStorage (an interior pointer into a managed continuation object) with GCPROTECT_BEGININTERIOR/GCPROTECT_END while executing the interpreter continuation.

Copy link
Copy Markdown
Member

@janvorli janvorli left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants