Skip to content

Fix concurrent generic constraint cache publication - #135181

Merged
jkotas merged 3 commits into
mainfrom
copilot/fix-concurrent-generic-constraint-loading
Oct 5, 2026
Merged

jkotas merged 3 commits into
mainfrom
copilot/fix-concurrent-generic-constraint-loading

Conversation

Copilot AI commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Concurrent first loads could publish All coverage for a different, partially populated constraint array. This change makes concurrent builders share one loader-lifetime array and publishes coverage only after filling the slots it promises.

  • Array publication: CAS-publish a zero-initialized candidate before filling; losing builders adopt the published array and back out their candidate.
  • Coverage: Keep the coverage CAS after the slot stores. Zero-constraint behavior is unchanged.

Fixes #134243

@azure-pipelines

azure-pipelines Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI changed the title [WIP] Fix concurrent generic constraint loading issue in CoreCLR Fix concurrent generic constraint cache publication Oct 4, 2026
Copilot AI requested a review from jkotas October 4, 2026 04:00
@jkotas jkotas added area-TypeSystem-coreclr and removed area-Infrastructure-coreclr Only use for closed issues labels Oct 4, 2026
@jkotas
jkotas marked this pull request as ready for review October 4, 2026 04:21
@jkotas
jkotas requested a balanced review from Copilot October 4, 2026 04:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

The concurrency fix lacks deterministic regression coverage for the failing interleavings.

Review effort: Balanced
Findings: 1 Low severity

Open (1)
What changed in this PR

Fixes a CoreCLR race by ensuring concurrent generic-constraint loaders populate one shared array before publishing coverage.

Changes:

  • CAS-publishes the constraint array before population.
  • Makes losing builders adopt the published array.
  • Preserves coverage publication after slot initialization.
File Description
src/​coreclr/​vm/​typedesc.cpp Corrects concurrent constraint-cache publication.

Comment thread src/coreclr/vm/typedesc.cpp Resolved
@jkotas
jkotas merged commit 5a58d2e into main Oct 5, 2026
123 of 125 checks passed
@jkotas
jkotas deleted the copilot/fix-concurrent-generic-constraint-loading branch October 5, 2026 20:19
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Oct 6, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Concurrent generic constraint loading can publish an incomplete array and crash CoreCLR

4 participants