Skip to content

Fix for assert failure in distribute free regions#66657

Merged
mangod9 merged 3 commits intodotnet:mainfrom
PeterSolMS:Second_fix_for_assert_failure_in_distribute_free_regions
Mar 15, 2022
Merged

Fix for assert failure in distribute free regions#66657
mangod9 merged 3 commits intodotnet:mainfrom
PeterSolMS:Second_fix_for_assert_failure_in_distribute_free_regions

Conversation

@PeterSolMS
Copy link
Contributor

@PeterSolMS PeterSolMS commented Mar 15, 2022

I had failed to take into account the case where we move a free region to the decommit list due to age, but it is among the free regions with the highest address, and so is encountered by move_highest_free_regions as well.

What happens then is that move_highest_free_regions removes it from the decommit list, and puts it on the decommit list again. No harm done, except that we didn't move as many regions to the decommit list as planned.

Fix is to check in move_highest_free_regions whether a region is already on the decommit list, and skip it in this case. I preferred this to loosening the assert because it makes sure we actually decommit as much as planned.

Fixes: #66601

…mong the highest free regions, and so gets moved to the decommit list again by region_allocator::move_highest_free_regions.

The fix is simply to check whether the region is already on the to_free_list and not move it or count it if it is.
@ghost ghost assigned PeterSolMS Mar 15, 2022
@ghost ghost added the area-GC-coreclr label Mar 15, 2022
@ghost
Copy link

ghost commented Mar 15, 2022

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

Issue Details

I had failed to take into account the case where we move a free region to the decommit list due to age, but it is among the free regions with the highest address, and so is encountered by move_highest_free_regions as well.

What happens then is that move_highest_free_regions removes it from the decommit list, and puts it on the decommit list again. No harm done, except that we didn't move as many regions to the decommit list as planned.

Fix is to check in move_highest_free_regions whether a region is already on the decommit list, and skip it in this case. I preferred this to loosening the assert because it makes sure we actually decommit as much as planned.

Author: PeterSolMS
Assignees: PeterSolMS
Labels:

area-GC-coreclr

Milestone: -

@mangod9 mangod9 merged commit 2a44236 into dotnet:main Mar 15, 2022
radekdoulik pushed a commit to radekdoulik/runtime that referenced this pull request Mar 30, 2022
* Fix the case where a region that was decommitted due to age is also among the highest free regions, and so gets moved to the decommit list again by region_allocator::move_highest_free_regions.

The fix is simply to check whether the region is already on the to_free_list and not move it or count it if it is.

* Fix typo.

* Fix logic in move_highest_free_regions.
@ghost ghost locked as resolved and limited conversation to collaborators Apr 14, 2022
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.

GC regions failure in System.Threading.Tests.dll

3 participants