Remove mask of SIGCHLD
authorAndrew Schwartzmeyer <andschwa@microsoft.com>
Mon, 22 Feb 2016 23:08:05 +0000 (15:08 -0800)
committerAndrew Schwartzmeyer <andschwa@microsoft.com>
Mon, 22 Feb 2016 23:08:05 +0000 (15:08 -0800)
When a .NET Core program invoked a process that invoked its own child,
the masking of SIGCHLD prevented the process from recognizing its child
had exited, which some processes require. This caused the .NET Core app
to hang in certain internal scenarios.

Commit migrated from https://github.com/dotnet/coreclr/commit/d0ede1557b29f833268845ba85fd27bb66fcb23b

src/coreclr/src/pal/src/thread/threadsusp.cpp

index 89e852a..90a10f0 100644 (file)
@@ -790,7 +790,9 @@ CThreadSuspensionInfo::InitializeSignalSets()
     // The default signal mask masks all common signals except those that represent 
     // synchronous exceptions in the PAL or are used by the system (e.g. SIGPROF on BSD).
     // Note that SIGPROF is used by the BSD thread scheduler and masking it caused a 
-    // significant reduction in performance.
+    // significant reduction in performance. Note that SIGCHLD is used by Linux
+    // for parent->child process notifications, and masking it caused parents
+    // not to recognize their children had died.
     sigaddset(&smDefaultmask, SIGHUP);
     sigaddset(&smDefaultmask, SIGABRT);
 #ifdef SIGEMT
@@ -801,7 +803,6 @@ CThreadSuspensionInfo::InitializeSignalSets()
     sigaddset(&smDefaultmask, SIGURG);
     sigaddset(&smDefaultmask, SIGTSTP);
     sigaddset(&smDefaultmask, SIGCONT);
-    sigaddset(&smDefaultmask, SIGCHLD);
     sigaddset(&smDefaultmask, SIGTTIN);
     sigaddset(&smDefaultmask, SIGTTOU);
     sigaddset(&smDefaultmask, SIGIO);