Skip to content

Remove concurrent verify_soh_segment_list call in background_sweep - #129873

Merged
janvorli merged 1 commit into
dotnet:mainfrom
janvorli:fix-verify-soh-segment-list
Jul 7, 2026
Merged

janvorli merged 1 commit into
dotnet:mainfrom
janvorli:fix-verify-soh-segment-list

Conversation

@janvorli

Copy link
Copy Markdown
Member

The removed call site runs inside the concurrent background sweep loop, after restart_EE(), when allocations and SOH segment-list mutations can run on other threads. verify_soh_segment_list assumes stable list topology while it walks generation links, so calling it in this window can observe in-flight updates and report false verification failures. We keep verification at synchronized GC phase boundaries and remove only this racy in-loop invocation.

Close #129723

The removed call site runs inside the concurrent background sweep loop,
after restart_EE(), when allocations and SOH segment-list mutations can
run on other threads. verify_soh_segment_list assumes stable list
topology while it walks generation links, so calling it in this window
can observe in-flight updates and report false verification failures. We
keep verification at synchronized GC phase boundaries and remove only
this racy in-loop invocation.
@janvorli janvorli added this to the 11.0.0 milestone Jun 26, 2026
@janvorli
janvorli requested a review from kkokosa June 26, 2026 00:05
@janvorli janvorli self-assigned this Jun 26, 2026
Copilot AI review requested due to automatic review settings June 26, 2026 00:05
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @anicka-net, @dotnet/gc
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.

Pull request overview

This PR removes an in-loop call to verify_soh_segment_list() from gc_heap::background_sweep() to avoid racy heap verification while the EE is restarted and concurrent allocations may be mutating the SOH segment list.

Changes:

  • Removed verify_soh_segment_list() invocation from the concurrent background sweep loop (segment-to-segment progression).

Comment thread src/coreclr/gc/background.cpp Resolved
@mangod9

mangod9 commented Jun 26, 2026

Copy link
Copy Markdown
Member

is this a regression from 10?

@janvorli

Copy link
Copy Markdown
Member Author

@mangod9 I don't know, I haven't checked if it was failing before.

@janvorli

janvorli commented Jul 7, 2026

Copy link
Copy Markdown
Member Author

/ba-g the failing test may be a roslyn bug and it is unrelated to this change

@janvorli
janvorli merged commit 5181654 into dotnet:main Jul 7, 2026
120 of 122 checks passed
@janvorli
janvorli deleted the fix-verify-soh-segment-list branch July 7, 2026 19:29
@dotnet-milestone-bot dotnet-milestone-bot Bot modified the milestones: 11.0.0, 11.0-preview7 Jul 8, 2026
eiriktsarpalis pushed a commit that referenced this pull request Jul 15, 2026
…129873)

The removed call site runs inside the concurrent background sweep loop,
after restart_EE(), when allocations and SOH segment-list mutations can
run on other threads. verify_soh_segment_list assumes stable list
topology while it walks generation links, so calling it in this window
can observe in-flight updates and report false verification failures. We
keep verification at synchronized GC phase boundaries and remove only
this racy in-loop invocation.

Close #129723
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 7, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test failure: GC/API/GC/GetAllocatedBytesForCurrentThread/GetAllocatedBytesForCurrentThread.cmd

4 participants