to prevent crash while process terminate on profiling mode, kill process immedately... accepted/tizen/unified/20190920.065334 submit/tizen/20190920.013818
authorWoongsuk Cho <ws77.cho@samsung.com>
Fri, 20 Sep 2019 01:03:46 +0000 (10:03 +0900)
committer이형주/Common Platform Lab(SR)/Staff Engineer/삼성전자 <leee.lee@samsung.com>
Fri, 20 Sep 2019 01:35:53 +0000 (10:35 +0900)
NativeLauncher/launcher/dotnet/dotnet_launcher.cc
NativeLauncher/launcher/dotnet/dotnet_launcher.h

index 57b6005..75a0341 100644 (file)
@@ -256,10 +256,18 @@ CoreRuntime::CoreRuntime(const char* mode) :
        __hostHandle(nullptr),
        __domainId(-1),
        fd(0),
-       __initialized(false)
+       __initialized(false),
+       __isProfileMode(false)
 {
        _INFO("Constructor called!!");
 
+       char *env = nullptr;
+       env = getenv("CORECLR_ENABLE_PROFILING");
+       if (env != nullptr && !strcmp(env, "1")) {
+               _INFO("profiling mode on");
+               __isProfileMode = true;
+       }
+
        // plugin initialize should be called before start loader mainloop.
        // In case of VD plugins, attaching secure zone is done in the plugin_initialize().
        // When attaching to a secure zone, if there is a created thread, it will failed.
@@ -277,6 +285,14 @@ CoreRuntime::CoreRuntime(const char* mode) :
 
 CoreRuntime::~CoreRuntime()
 {
+       // workaround : to prevent crash while process terminate on profiling mode,
+       //              kill process immediately.
+       // see https://github.com/dotnet/coreclr/issues/26687
+       if (__isProfileMode) {
+               _INFO("shutdown process immediately.");
+               _exit(0);
+       }
+
        dispose();
 }
 
index e9e6c5d..704070b 100644 (file)
@@ -50,6 +50,7 @@ class CoreRuntime
                int fd;
                bool __initialized;
                bool __enableLogManager;
+               bool __isProfileMode;
 };
 
 }  // dotnetcore