Skip to content

Fix handling of inability to get free region in thread_final_regions - #131830

Merged
janvorli merged 1 commit into
dotnet:mainfrom
janvorli:replace-assert-by-fatal-gc-error
Aug 5, 2026
Merged

Fix handling of inability to get free region in thread_final_regions#131830
janvorli merged 1 commit into
dotnet:mainfrom
janvorli:replace-assert-by-fatal-gc-error

Conversation

@janvorli

@janvorli janvorli commented Aug 4, 2026

Copy link
Copy Markdown
Member

The core currently asserts when get_free_region returns NULL. In release builds, it would just crash. The failure to get free region in the thread_final_regions represents an OOM that is not recoverable at that point.

This change replaces the assert by FATAL_GC_ERROR instead.

Close #131818

The core currently asserts when get_free_region returns NULL. In release
builds, it would just crash. The failure to get free region in the
thread_final_regions represents an OOM that is not recoverable at that
point.

This change replaces the assert by FATAL_GC_ERROR instead.
@janvorli janvorli added this to the 11.0.0 milestone Aug 4, 2026
@janvorli
janvorli requested a review from kkokosa August 4, 2026 20:36
@janvorli janvorli self-assigned this Aug 4, 2026
Copilot AI review requested due to automatic review settings August 4, 2026 20:36
@janvorli

janvorli commented Aug 4, 2026

Copy link
Copy Markdown
Member Author

This issue was discovered when investigating #131818

@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: @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

Updates CoreCLR GC region-threading logic to handle get_free_region returning null by treating it as an unrecoverable failure, avoiding debug-only asserts and ensuring a consistent fail-fast behavior.

Changes:

  • Replace assert(start_region) with an explicit null check and FATAL_GC_ERROR() in gc_heap::thread_final_regions.

Comment thread src/coreclr/gc/plan_phase.cpp

@JulieLeeMSFT JulieLeeMSFT left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM.

@janvorli

janvorli commented Aug 5, 2026

Copy link
Copy Markdown
Member Author

/ba-g the failures are unrelated and known

@janvorli
janvorli merged commit 0b3d90c into dotnet:main Aug 5, 2026
120 of 122 checks passed
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.

Assertion failed: start_region in src\coreclr\gc\plan_phase.cpp

3 participants