镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Fail to get_free_region in thread_final_regions due to low memory for mark array might lead to AV. #74401

Closed

Description

@cshung

While our logic guarantee a free region is available in the free region list before thread_final_regions, in case we are running out of memory to commit for the mark array, the call to init_table_for_region called in get_free_region may fail and therefore return nullptr.

To reproduce the issue, we can run GCPerfSim with these parameters:

GCPerfSim.dll -tc 6 -tagb 100.0 -tlgb 0.2 -lohar 0 -pohar 0 -sohsi 10 -lohsi 0 -pohsi 0 -sohsr 100-4000 -lohsr 102400-204800 -pohsr 100-4000 -sohpi 10 -lohpi 0 -sohfi 0 -lohfi 0 -pohfi 0 -allocType reference -testKind time

and these environment variables:

COMPlus_GCHeapCount=6
COMPlus_GCHeapHardLimit=1C200000
COMPlus_GCServer=1

On this commit 5f80c24 with a simple change to replace this line in sufficient_space_regions

return check_against_hard_limit (end_space_required);

to

return true;

The change was made to make this easier to repro only and is not an intended product change.

To make this issue easier to identify, we can add a check after get_free_region in thread_final_regions as follow. Change

start_region = get_free_region (gen_idx);

to

start_region = get_free_region (gen_idx);
if (start_region == nullptr) { FATAL_GC_ERROR(); }

The process will fail at the spot. Without the check, the nullptr might be threaded into the generation, and will lead to bad consequences (such as an AV).

Activity

  1. self-assigned this
    on Aug 23, 2022
  2. ghost added
    untriagedNew issue has not been triaged by the area owner
    on Aug 23, 2022
  3. removed
    untriagedNew issue has not been triaged by the area owner
    on Aug 23, 2022
  4. added this to the 7.0.0 milestone on Aug 23, 2022
  5. ghost added
    in-prThere is an active PR which will close this issue when it is merged
    on Sep 2, 2022
  6. mangod9 commented on Sep 21, 2022

    @mangod9
    Member

    moving to 8 for now.

  7. modified the milestones: 7.0.0, 8.0.0 on Sep 21, 2022
  8. ghost removed
    in-prThere is an active PR which will close this issue when it is merged
    on Oct 7, 2022
  9. linked a pull request that will close this issueRemove hard_limit_for_bookkeeping #77480on Oct 26, 2022
  10. ghost locked as resolved and limited conversation to collaborators on Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions