Skip to content

Commit 28ce2cc

Browse files
authored
Fix stack overflow handling issue in GC stress (#56733)
This change fixes a problem when in GC stress mode 3, GC started to run on the thread that hit stack overflow due to the GCX_PREEMP in DebuggerRCThread::DoFavor that is called from the EEPolicy::HandleFatalStackOverflow. It was causing failures in the CI. The issue is GC stress specific, the GCX_PREEMP would not start running GC on the current thread in regular cases. The fix is to inhibit GC stress in the HandleFatalStackOverflow.
1 parent b3ab2eb commit 28ce2cc

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/coreclr/vm/eepolicy.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,10 @@ void DECLSPEC_NORETURN EEPolicy::HandleFatalStackOverflow(EXCEPTION_POINTERS *pE
616616

617617
WRAPPER_NO_CONTRACT;
618618

619+
// Disable GC stress triggering GC at this point, we don't want the GC to start running
620+
// on this thread when we have only a very limited space left on the stack
621+
GCStressPolicy::InhibitHolder iholder;
622+
619623
STRESS_LOG0(LF_EH, LL_INFO100, "In EEPolicy::HandleFatalStackOverflow\n");
620624

621625
FrameWithCookie<FaultingExceptionFrame> fef;

0 commit comments

Comments
 (0)