Skip to content

Commit a494d22

Browse files
authored
[Release/8.0] Remove preventing EH at shutdown (#100836)
Partial backport of #100293 to release/8.0
1 parent 6f29267 commit a494d22

File tree

6 files changed

+2
-25
lines changed

6 files changed

+2
-25
lines changed

src/coreclr/vm/ceemain.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,9 +1331,6 @@ void STDMETHODCALLTYPE EEShutDownHelper(BOOL fIsDllUnloading)
13311331
// Shutdown finalizer before we suspend all background threads. Otherwise we
13321332
// never get to finalize anything.
13331333

1334-
// No longer process exceptions
1335-
g_fNoExceptions = true;
1336-
13371334
// <TODO>@TODO: This does things which shouldn't occur in part 2. Namely,
13381335
// calling managed dll main callbacks (AppDomain::SignalProcessDetach), and
13391336
// RemoveAppDomainFromIPC.

src/coreclr/vm/eepolicy.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,6 @@ void SafeExitProcess(UINT exitCode, ShutdownCompleteAction sca = SCA_ExitProcess
5959
}
6060
}
6161

62-
// Turn off exception processing, because if some other random DLL has a
63-
// fault in DLL_PROCESS_DETACH, we could get called for exception handling.
64-
// Since we've turned off part of the runtime, we can't, for instance,
65-
// properly execute the GC that handling an exception might trigger.
66-
g_fNoExceptions = true;
67-
LOG((LF_EH, LL_INFO10, "SafeExitProcess: turning off exceptions\n"));
68-
6962
if (sca == SCA_TerminateProcessWhenShutdownComplete)
7063
{
7164
// disabled because if we fault in this code path we will trigger our Watson code

src/coreclr/vm/excep.cpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4623,12 +4623,6 @@ LONG InternalUnhandledExceptionFilter_Worker(
46234623
}
46244624
#endif
46254625

4626-
// This shouldn't be possible, but MSVC re-installs us... for now, just bail if this happens.
4627-
if (g_fNoExceptions)
4628-
{
4629-
return EXCEPTION_CONTINUE_SEARCH;
4630-
}
4631-
46324626
// Are we looking at a stack overflow here?
46334627
if ((pThread != NULL) && !pThread->DetermineIfGuardPagePresent())
46344628
{
@@ -5533,8 +5527,6 @@ static LONG ThreadBaseExceptionFilter_Worker(PEXCEPTION_POINTERS pExceptionInfo,
55335527
ThreadBaseExceptionFilterParam *pParam = (ThreadBaseExceptionFilterParam *) pvParam;
55345528
UnhandledExceptionLocation location = pParam->location;
55355529

5536-
_ASSERTE(!g_fNoExceptions);
5537-
55385530
Thread* pThread = GetThread();
55395531

55405532
#ifdef _DEBUG
@@ -7393,8 +7385,8 @@ LONG WINAPI CLRVectoredExceptionHandlerShim(PEXCEPTION_POINTERS pExceptionInfo)
73937385
// WARNING WARNING WARNING WARNING WARNING WARNING WARNING
73947386
//
73957387

7396-
// If exceptions (or runtime) have been disabled, then simply return.
7397-
if (g_fForbidEnterEE || g_fNoExceptions)
7388+
// If runtime have been disabled, then simply return.
7389+
if (g_fForbidEnterEE)
73987390
{
73997391
return EXCEPTION_CONTINUE_SEARCH;
74007392
}

src/coreclr/vm/i386/excepx86.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1571,9 +1571,6 @@ EXCEPTION_HANDLER_IMPL(COMPlusFrameHandler)
15711571

15721572
_ASSERTE((pContext == NULL) || ((pContext->ContextFlags & CONTEXT_CONTROL) == CONTEXT_CONTROL));
15731573

1574-
if (g_fNoExceptions)
1575-
return ExceptionContinueSearch; // No EH during EE shutdown.
1576-
15771574
// Check if the exception represents a GCStress Marker. If it does,
15781575
// we shouldnt record its entry in the TLS as such exceptions are
15791576
// continuable and can confuse the VM to treat them as CSE,

src/coreclr/vm/vars.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,6 @@ GVAL_IMPL(SIZE_T, g_runtimeVirtualSize);
193193

194194
Volatile<LONG> g_fForbidEnterEE = false;
195195
bool g_fManagedAttach = false;
196-
bool g_fNoExceptions = false;
197196

198197
DWORD g_FinalizerWaiterStatus = 0;
199198

src/coreclr/vm/vars.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,6 @@ GVAL_DECL(bool, g_fProcessDetach);
477477
GVAL_DECL(bool, g_metadataUpdatesApplied);
478478
#endif
479479
EXTERN bool g_fManagedAttach;
480-
EXTERN bool g_fNoExceptions;
481480

482481
// Indicates whether we're executing shut down as a result of DllMain
483482
// (DLL_PROCESS_DETACH). See comments at code:EEShutDown for details.

0 commit comments

Comments
 (0)