summaryrefslogtreecommitdiff
path: root/src/vm
diff options
context:
space:
mode:
authorDaniel Harvey <dharvey@microsoft.com>2018-03-29 11:59:19 -0700
committerGitHub <noreply@github.com>2018-03-29 11:59:19 -0700
commit54c2b5bcaccefb4259aba2d0aca8cef89b6b5b6b (patch)
tree30ea11abf3c7cb198961ee4494dc7cf8c9403cb1 /src/vm
parentc504be9158c321cd8c106c569ab76863e95135e0 (diff)
downloadcoreclr-54c2b5bcaccefb4259aba2d0aca8cef89b6b5b6b.tar.gz
coreclr-54c2b5bcaccefb4259aba2d0aca8cef89b6b5b6b.tar.bz2
coreclr-54c2b5bcaccefb4259aba2d0aca8cef89b6b5b6b.zip
Fix AssemblyLoadContext.Unloading and ProcessExit for Windows Docker containers (#17265)
On Windows, we need to shutdown the EE when receiving a CTRL_CLOSE_EVENT to we run ProcessExit handlers and other code that relies on ProcessExit working (like AssemblyLoadContext.Unloading). One way we receive this event is when there's a running process in a docker container that has the stop command run against it.
Diffstat (limited to 'src/vm')
-rw-r--r--src/vm/ceemain.cpp8
-rw-r--r--src/vm/eeconfig.cpp2
2 files changed, 7 insertions, 3 deletions
diff --git a/src/vm/ceemain.cpp b/src/vm/ceemain.cpp
index b09d970947..20b579af9a 100644
--- a/src/vm/ceemain.cpp
+++ b/src/vm/ceemain.cpp
@@ -446,7 +446,13 @@ static BOOL WINAPI DbgCtrlCHandler(DWORD dwCtrlType)
}
else
#endif // DEBUGGING_SUPPORTED
- {
+ {
+ if (dwCtrlType == CTRL_CLOSE_EVENT)
+ {
+ // Initiate shutdown so the ProcessExit handlers run
+ ForceEEShutdown(SCA_ReturnWhenShutdownComplete);
+ }
+
g_fInControlC = true; // only for weakening assertions in checked build.
return FALSE; // keep looking for a real handler.
}
diff --git a/src/vm/eeconfig.cpp b/src/vm/eeconfig.cpp
index a227437356..1b44367e84 100644
--- a/src/vm/eeconfig.cpp
+++ b/src/vm/eeconfig.cpp
@@ -166,7 +166,6 @@ void *EEConfig::operator new(size_t size)
RETURN g_EEConfigMemory;
}
-
/**************************************************************/
HRESULT EEConfig::Init()
{
@@ -393,7 +392,6 @@ HRESULT EEConfig::Init()
// statically link to EEConfig.
CLRConfig::RegisterGetConfigValueCallback(&GetConfigValueCallback);
-
return S_OK;
}