From bfb028b80f97ce853ff8c4ea0f98e596af5da0cc Mon Sep 17 00:00:00 2001 From: Maoni Stephens Date: Wed, 12 Jun 2024 19:23:18 -0700 Subject: [PATCH] fix hang in failure case (#103386) when prepare_to_change_heap_count fails, we need to make sure to restart the EE otherwise the GC thread still holds the thread store lock --- src/coreclr/gc/gc.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/coreclr/gc/gc.cpp b/src/coreclr/gc/gc.cpp index 721d47c1043..639a5b1a0eb 100644 --- a/src/coreclr/gc/gc.cpp +++ b/src/coreclr/gc/gc.cpp @@ -25621,8 +25621,6 @@ void gc_heap::check_heap_count () // background GC is running - reset the new heap count dynamic_heap_count_data.new_n_heaps = n_heaps; dprintf (6666, ("can't change heap count! BGC in progress")); - - GCToEEInterface::RestartEE(TRUE); } #endif //BACKGROUND_GC } @@ -25646,6 +25644,8 @@ void gc_heap::check_heap_count () dprintf (6666, ("heap count stays the same %d, no work to do, set processed sample count to %Id", dynamic_heap_count_data.new_n_heaps, dynamic_heap_count_data.current_samples_count)); + GCToEEInterface::RestartEE(TRUE); + return; }