summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKoundinya Veluri <kouvel@users.noreply.github.com>2018-03-06 11:42:13 -0800
committerGitHub <noreply@github.com>2018-03-06 11:42:13 -0800
commit88e9fb63e5e49ce72a50e2e677fa74d951dc5057 (patch)
tree9762da02b78efeb1bb532ab63063204520f8b0b1 /src
parent063e8d07f80c8e7e026e42b52cbe9addf50c884d (diff)
downloadcoreclr-88e9fb63e5e49ce72a50e2e677fa74d951dc5057.tar.gz
coreclr-88e9fb63e5e49ce72a50e2e677fa74d951dc5057.tar.bz2
coreclr-88e9fb63e5e49ce72a50e2e677fa74d951dc5057.zip
Fix hang on Ctrl+C when tiering is enabled (#16719)
Fix hang on Ctrl+C when tiering is enabled - When the work thread count is nonzero at the time of Ctrl+C, by the time `TieredCompilationManager::Shutdown(BOOL)` runs (during `DllMain` for process detach), the background worker thread has already been torn down abruptly and it does not get a chance to exit gracefully and set the event, and Shutdown() hangs the process waiting for the event forever. - It looks like there is no benefit to waiting for the work to complete, fixed by removing the wait and the event - In the MusicStore benchmark it looks like the arch folder was missing in the 'publish' folder path. In case there is a difference in bin directory layout between the CI dotnet and current dotnet, changed to check for both paths.
Diffstat (limited to 'src')
-rw-r--r--src/vm/appdomain.cpp2
-rw-r--r--src/vm/ceemain.cpp7
-rw-r--r--src/vm/tieredcompilation.cpp35
-rw-r--r--src/vm/tieredcompilation.h3
4 files changed, 5 insertions, 42 deletions
diff --git a/src/vm/appdomain.cpp b/src/vm/appdomain.cpp
index 96fd088c03..8bb747b614 100644
--- a/src/vm/appdomain.cpp
+++ b/src/vm/appdomain.cpp
@@ -8026,7 +8026,7 @@ void AppDomain::Exit(BOOL fRunFinalizers, BOOL fAsyncExit)
// have exited the domain.
//
#ifdef FEATURE_TIERED_COMPILATION
- m_tieredCompilationManager.Shutdown(FALSE);
+ m_tieredCompilationManager.Shutdown();
#endif
//
diff --git a/src/vm/ceemain.cpp b/src/vm/ceemain.cpp
index e9b914e0cf..05384c3330 100644
--- a/src/vm/ceemain.cpp
+++ b/src/vm/ceemain.cpp
@@ -1641,13 +1641,6 @@ void STDMETHODCALLTYPE EEShutDownHelper(BOOL fIsDllUnloading)
// Indicate the EE is the shut down phase.
g_fEEShutDown |= ShutDown_Start;
-#ifdef FEATURE_TIERED_COMPILATION
- {
- GCX_PREEMP();
- TieredCompilationManager::ShutdownAllDomains();
- }
-#endif
-
fFinalizeOK = TRUE;
// Terminate the BBSweep thread
diff --git a/src/vm/tieredcompilation.cpp b/src/vm/tieredcompilation.cpp
index f89f4f2e6b..cd571a6b47 100644
--- a/src/vm/tieredcompilation.cpp
+++ b/src/vm/tieredcompilation.cpp
@@ -108,7 +108,6 @@ void TieredCompilationManager::Init(ADID appDomainId)
SpinLockHolder holder(&m_lock);
m_domainId = appDomainId;
m_callCountOptimizationThreshhold = g_pConfig->TieredCompilation_Tier1CallCountThreshold();
- m_asyncWorkDoneEvent.CreateManualEventNoThrow(TRUE);
}
void TieredCompilationManager::InitiateTier1CountingDelay()
@@ -318,35 +317,12 @@ void TieredCompilationManager::AsyncPromoteMethodToTier1(MethodDesc* pMethodDesc
return;
}
-// static
-// called from EEShutDownHelper
-void TieredCompilationManager::ShutdownAllDomains()
+void TieredCompilationManager::Shutdown()
{
STANDARD_VM_CONTRACT;
- AppDomainIterator domain(TRUE);
- while (domain.Next())
- {
- AppDomain * pDomain = domain.GetDomain();
- if (pDomain != NULL)
- {
- pDomain->GetTieredCompilationManager()->Shutdown(TRUE);
- }
- }
-}
-
-void TieredCompilationManager::Shutdown(BOOL fBlockUntilAsyncWorkIsComplete)
-{
- STANDARD_VM_CONTRACT;
-
- {
- SpinLockHolder holder(&m_lock);
- m_isAppDomainShuttingDown = TRUE;
- }
- if (fBlockUntilAsyncWorkIsComplete)
- {
- m_asyncWorkDoneEvent.Wait(INFINITE, FALSE);
- }
+ SpinLockHolder holder(&m_lock);
+ m_isAppDomainShuttingDown = TRUE;
}
VOID WINAPI TieredCompilationManager::Tier1DelayTimerCallback(PVOID parameter, BOOLEAN timerFired)
@@ -619,7 +595,6 @@ void TieredCompilationManager::IncrementWorkerThreadCount()
//m_lock should be held
m_countOptimizationThreadsRunning++;
- m_asyncWorkDoneEvent.Reset();
}
void TieredCompilationManager::DecrementWorkerThreadCount()
@@ -628,10 +603,6 @@ void TieredCompilationManager::DecrementWorkerThreadCount()
//m_lock should be held
m_countOptimizationThreadsRunning--;
- if (m_countOptimizationThreadsRunning == 0)
- {
- m_asyncWorkDoneEvent.Set();
- }
}
//static
diff --git a/src/vm/tieredcompilation.h b/src/vm/tieredcompilation.h
index 95dbb741fc..2665ad4abf 100644
--- a/src/vm/tieredcompilation.h
+++ b/src/vm/tieredcompilation.h
@@ -32,8 +32,7 @@ public:
void OnMethodCalled(MethodDesc* pMethodDesc, DWORD currentCallCount, BOOL* shouldStopCountingCallsRef, BOOL* wasPromotedToTier1Ref);
void OnMethodCallCountingStoppedWithoutTier1Promotion(MethodDesc* pMethodDesc);
void AsyncPromoteMethodToTier1(MethodDesc* pMethodDesc);
- static void ShutdownAllDomains();
- void Shutdown(BOOL fBlockUntilAsyncWorkIsComplete);
+ void Shutdown();
static CORJIT_FLAGS GetJitFlags(NativeCodeVersion nativeCodeVersion);
private: