Subject: Re: bug#17561: Emacs can forget processes

From: Andreas Schwab <[email-masked]>
Date: Thu, 29 May 2014 19:55:20 +0200

Jorgen Schaefer <[email-masked]> writes:

> It works. A bit later:
>
> rt_sigprocmask(SIG_BLOCK, [CHLD], [QUIT ALRM PROF], 8) = 0
> rt_sigprocmask(SIG_SETMASK, [QUIT ALRM PROF], NULL, 8) = 0
>
> That's fine, CHLD is not masked. A while later, then, this:
>
> --- SIGIO (I/O possible) @ 0 (0) ---
> rt_sigreturn(0x1d)                      = 11684722
> ioctl(3, FIONREAD, [0])                 = 0
> rt_sigprocmask(SIG_BLOCK, [CHLD], [QUIT ALRM CHLD PROF], 8) = 0

So the damage happend somewhere between these blocks.  Please try this
patch to better see when CHLD became blocked:

diff --git a/src/sysdep.c b/src/sysdep.c
index e5b2920..35c2856 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -618,6 +618,7 @@ request_sigio (void)
 {
 #ifdef USABLE_SIGIO
   sigset_t unblocked;
+  sigset_t oldmask;
 
   if (noninteractive)
     return;
@@ -627,7 +628,7 @@ request_sigio (void)
   sigaddset (&unblocked, SIGWINCH);
 # endif
   sigaddset (&unblocked, SIGIO);
-  pthread_sigmask (SIG_UNBLOCK, &unblocked, 0);
+  pthread_sigmask (SIG_UNBLOCK, &unblocked, &oldmask);
 
   interrupts_deferred = 0;
 #endif
@@ -638,6 +639,7 @@ unrequest_sigio (void)
 {
 #ifdef USABLE_SIGIO
   sigset_t blocked;
+  sigset_t oldmask;
 
   if (noninteractive)
     return;
@@ -647,7 +649,7 @@ unrequest_sigio (void)
   sigaddset (&blocked, SIGWINCH);
 # endif
   sigaddset (&blocked, SIGIO);
-  pthread_sigmask (SIG_BLOCK, &blocked, 0);
+  pthread_sigmask (SIG_BLOCK, &blocked, &oldmask);
   interrupts_deferred = 1;
 #endif
 }

Andreas.

-- 
Andreas Schwab, [email-masked]
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."