Skip to content

Commit

Permalink
Fix stack overflow handling issue in GC stress (#56733)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
janvorli committed Aug 3, 2021
1 parent b3ab2eb commit 28ce2cc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/coreclr/vm/eepolicy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,10 @@ void DECLSPEC_NORETURN EEPolicy::HandleFatalStackOverflow(EXCEPTION_POINTERS *pE

WRAPPER_NO_CONTRACT;

// Disable GC stress triggering GC at this point, we don't want the GC to start running
// on this thread when we have only a very limited space left on the stack
GCStressPolicy::InhibitHolder iholder;

STRESS_LOG0(LF_EH, LL_INFO100, "In EEPolicy::HandleFatalStackOverflow\n");

FrameWithCookie<FaultingExceptionFrame> fef;
Expand Down

0 comments on commit 28ce2cc

Please sign in to comment.