You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Jeff Trawick <tr...@bellsouth.net> on 2001/02/27 04:22:32 UTC

Re: threaded MPM and the signal thread

Jeff Trawick <tr...@bellsouth.net> writes:

> watch out non-Linux-ers...
> 
> Since the signal handling was moved around in the threaded MPM, on
> Tru64 and AIX the child processes are looping somewhere and they don't
> respond to SIGTERM.

It seems that the problems started when we went from

  sigemptyset(&sig_mask);
  sigaddset(&sig_mask, SIGINT);
  sigaddset(&sig_mask, SIGTERM);

to 

  sigfillset(&sig_mask);

when building the mask for sigwait().

It turns out that AIX and Tru64 have "issues" with this.

The code snipped below from a test program I wrote illustrates what
unexpected attention to the signal mask is required on AIX and Tru64
(and perhaps other platforms, but certainly not Linux and Solaris).

When APR builds again I'll try similar logic in the new signal
functions and hopefully the issues with the threaded MPM on AIX and
Tru64 will be gone.

It is safe to do the sigdelset() calls in common code, as long as we
test for the definition of the signal.  There is one piece of code
(clearing the high-order bit) which is very much AIX-specific though.

#ifdef _AIX
        printf("signal mask after sigfillset() but before fixing:\n");
        show_sig_mask(&sig_mask);
        /* we shouldn't have to do this, but sigwait() on AIX 4.3.3 doesn't
         * work correctly with all the bits on */

        /* with any of the first four in the set, sigwait() returns EINVAL */
        sigdelset(&sig_mask, SIGKILL);
        sigdelset(&sig_mask, SIGSTOP);
        sigdelset(&sig_mask, SIGCONT);
        sigdelset(&sig_mask, SIGWAITING);

        /* with this bit on, sigwait() blocks but never wakes up */
        /* manually turn this off because sigdelset() returns an error when you try to clear it */
        sig_mask.hisigs &= 0x7FFFFFFF;
#endif /* _AIX */
#ifdef TRU64
        printf("signal mask after sigfillset() but before fixing:\n");
        show_sig_mask(&sig_mask);

        /* with any of these three signals in the set, sigwait() returns EINVAL */
        sigdelset(&sig_mask, SIGKILL);
        sigdelset(&sig_mask, SIGSTOP);
        sigdelset(&sig_mask, SIGCONT);
#endif

-- 
Jeff Trawick | trawickj@bellsouth.net | PGP public key at web site:
       http://www.geocities.com/SiliconValley/Park/9289/
             Born in Roswell... married an alien...