Skip to content

[release/11.0] Fix VSD cache lock ordering during unload (backport #133213) - #134159

Merged
JulieLeeMSFT merged 1 commit into
dotnet:release/11.0from
adamperlin:adamperlin/backport-vsd-lock-fix
Sep 18, 2026
Merged

JulieLeeMSFT merged 1 commit into
dotnet:release/11.0from
adamperlin:adamperlin/backport-vsd-lock-fix

Conversation

@adamperlin

@adamperlin adamperlin commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Backport of #133213 to release/11.0

Customer Impact

  • Customer reported
  • Found internally

The PR fixes a lock issue which occurs in the VirtualCallStubManager destructor when cleaning up an AssemblyLoadContext. It is a regression for .NET 11 that originates in #128868 where a new lock aquisition was added for g_resolveCache.

Regression

  • Yes
  • No

Testing

A regression test was added that successfully reproduced the issue, which is now passing with the fix.

Risk

Low.

## Summary

- release the virtual stub dispatch cache lock before deleting loader
heaps that acquire the executable allocator lock
- add a collectible `AssemblyLoadContext` regression test that grows the
VSD cache entry heap and exercises the lock-order failure

Fixes dotnet#132982

## Testing

- `build.cmd clr -rc checked`
- `src\tests\build.cmd -Test
Regressions\coreclr\GitHub_132982\test132982.csproj x64 checked
-Priority 1`
- confirmed the regression test triggers the `CrstStubDispatchCache` /
`CrstExecutableAllocatorLock` level violation without the fix and passes
with the fix

> [!NOTE]
> This pull request description was generated with GitHub Copilot.

---------

Copilot-Session: dafdc384-5b50-4f91-a024-00a1dafbc0d3
@azure-pipelines

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.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @agocke
See info in area-owners.md if you want to be subscribed.

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.

🟡 Changes recommended

Add the required process-isolation property to the regression test project.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Backports a fix for VSD cache lock ordering during collectible AssemblyLoadContext unloading.

Changes:

  • Narrows the cache lock scope before loader-heap cleanup.
  • Adds a regression test exercising collectible unloading and VSD cache growth.
  • Configures CoreCLR test compatibility settings.
File summaries
File Reviewed changes
src/tests/Regressions/coreclr/GitHub_132982/test132982.csproj Registers the regression test; requires process-isolation configuration.
src/tests/Regressions/coreclr/GitHub_132982/test132982.cs Tests collectible AssemblyLoadContext unloading and VSD cache growth.
src/coreclr/vm/virtualcallstub.cpp Releases the cache lock before loader-heap cleanup.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread src/tests/Regressions/coreclr/GitHub_132982/test132982.csproj
@JulieLeeMSFT JulieLeeMSFT added this to the 11.0.0 milestone Sep 17, 2026
@JulieLeeMSFT JulieLeeMSFT added the Servicing-consider Issue for next servicing release review label Sep 17, 2026
@JulieLeeMSFT

Copy link
Copy Markdown
Member

Approved pending you resolve copilot feedback, get code review and check CI failures.

@ViveliDuCh

Copy link
Copy Markdown
Member

Hi,

the code complete date for RC2 is Monday 21st September. Make sure to merge this PR on that date at the latest, or it won't make it into that release.

As a reminder, if this is a product change, you also need Tactics approval before merging this PR (test-only or infra-only changes don't require Tactics approval).

@JulieLeeMSFT

Copy link
Copy Markdown
Member

/ba-g no failures but build analysis is red. Known issue for broken build analysis.

@JulieLeeMSFT

Copy link
Copy Markdown
Member

Hi,

the code complete date for RC2 is Monday 21st September. Make sure to merge this PR on that date at the latest, or it won't make it into that release.

As a reminder, if this is a product change, you also need Tactics approval before merging this PR (test-only or infra-only changes don't require Tactics approval).

.NET 11 fix is M1 approval until RC2 snap. After that, .NET 11 fix will need tactics approval.

@JulieLeeMSFT JulieLeeMSFT added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels Sep 18, 2026
@JulieLeeMSFT
JulieLeeMSFT merged commit fb4c74b into dotnet:release/11.0 Sep 18, 2026
130 of 135 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-VM-coreclr Servicing-approved Approved for servicing release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants