From: Woongsuk Cho Date: Mon, 26 Nov 2018 08:12:57 +0000 (+0900) Subject: If the native upcall comes after starting coreclr shutdown steps, SIGABRT is raised... X-Git-Tag: accepted/tizen/5.0/unified/20181127.073218^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d0f3a07e5fede74cc7b83634ad1c5b0fff36d02d;p=platform%2Fcore%2Fdotnet%2Flauncher.git If the native upcall comes after starting coreclr shutdown steps, SIGABRT is raised by the PalException. To avoid that kind of crash, ignore SIGABRT after starting coreclr shutdown. --- diff --git a/NativeLauncher/launcher/dotnet/dotnet_launcher.cc b/NativeLauncher/launcher/dotnet/dotnet_launcher.cc index c7e28e8..7cd16b9 100644 --- a/NativeLauncher/launcher/dotnet/dotnet_launcher.cc +++ b/NativeLauncher/launcher/dotnet/dotnet_launcher.cc @@ -127,12 +127,19 @@ struct sigaction sig_abrt_new; struct sigaction sig_abrt_old; static bool checkOnSigabrt = false; +static bool checkOnTerminate = false; static void onSigabrt(int signum) { // use unused variable to avoid build warning ssize_t ret = write(STDERR_FILENO, "onSigabrt called\n", 17); + if (checkOnTerminate) { + ret = write(STDERR_FILENO, "onSigabrt called while terminate. go to exit\n", 45); + _unused(ret); + exit(0); + } + if (checkOnSigabrt) { ret = write(STDERR_FILENO, "onSigabrt called again. go to exit\n", 35); _unused(ret); @@ -403,6 +410,12 @@ bool CoreRuntime::initializeCoreClr(const char* appId, void CoreRuntime::dispose() { + // call finalize plugin callback before shutdown coreclr + finalizePluginManager(); + + // ignore the signal generated by an exception that occurred during shutdown + checkOnTerminate = true; + if (__hostHandle != nullptr) { int st = shutdown(__hostHandle, __domainId); if (st < 0) @@ -418,7 +431,6 @@ void CoreRuntime::dispose() __coreclrLib = nullptr; } - finalizePluginManager(); finalizePathManager(); __envList.clear();