Skip to content

[release/10.0] GC handle DAC bugfix#124914

Open
rcj1 wants to merge 2 commits intodotnet:release/10.0from
rcj1:backport-124875
Open

[release/10.0] GC handle DAC bugfix#124914
rcj1 wants to merge 2 commits intodotnet:release/10.0from
rcj1:backport-124875

Conversation

@rcj1
Copy link
Contributor

@rcj1 rcj1 commented Feb 26, 2026

Backport of #124875 to release/10.0

Customer Impact

  • Customer reported
  • Found internally

This affects the GetHandleEnum, GetHandleEnumForTypes, and GetHandleEnumForGC DAC APIs. A bug was found in #124760 where the number of handle tables per bucket is assumed to be equal to the number of heaps in the server-GC mode. However, it is actually fixed at the number of processors; with DATAs enabled, these two may diverge and cause an incomplete enumeration of GC handles. This fix sets the correct bounds for this DAC APIs.

Regression

  • Yes
  • No

Since introduction of DATAs, handle enumeration may not be complete.

Testing

Tested locally

Risk

Low. The change corrects bounds for a single DAC enumeration loop.

@dotnet-policy-service
Copy link
Contributor

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

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

This PR backports a critical GC handle enumeration bugfix from #124875 to the release/10.0 branch. The issue occurs when using DATAS (Dynamic Adaptation To Application Sizes) where the number of GC heaps can differ from the processor count, causing the DAC (Data Access Component) to incompletely enumerate handle table buckets. The fix exposes the processor count via the GC DAC contract and updates handle enumeration logic to use it instead of assuming heap count equals processor count.

Changes:

  • Exposes g_totalCpuCount as a global variable on both Unix and Windows platforms for DAC access
  • Bumps GC interface minor version from 5 to 8 to indicate DAC contract extension
  • Updates DAC handle enumeration to use processor count with backward compatibility fallback

Reviewed changes

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

Show a summary per file
File Description
src/coreclr/gc/windows/gcenv.windows.cpp Adds caching for g_totalCpuCount in GetTotalProcessorCount() matching Unix implementation
src/coreclr/gc/unix/gcenv.unix.cpp Changes g_totalCpuCount from static to global visibility for DAC exposure
src/coreclr/gc/gcinterface.h Bumps GC_INTERFACE_MINOR_VERSION from 5 to 8
src/coreclr/gc/gcinterface.dacvars.def Adds g_totalCpuCount to DAC variable definitions for v5.8
src/coreclr/gc/gc.cpp Updates PopulateDacVars to expose g_totalCpuCount pointer for server GC builds
src/coreclr/debug/daccess/daccess.cpp Updates handle enumeration to use processor count from DAC contract v8+, with GCHeapCount() fallback

@steveisok steveisok changed the title Backport GC handle DAC bugfix [release/10.0] GC handle DAC bugfix Feb 26, 2026
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