You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Jeff Trawick <tr...@bellsouth.net> on 2001/02/23 00:16:03 UTC

threaded MPM and the signal thread

(this is sort of a brain dump; problems are piling up on my desk and
I'm not keeping up; I'm not sure what this post will change but maybe
somebody knows what is going on)

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.

With Tru64, I played with the signal thread code with varying
results.  With unmodified code sometimes the signal function loops
because sigwait() is returning EINVAL.  I don't know whether or not
that was the only busy loop.  I modified the signal thread code to
create a signal set with only SIGTERM and SIGINT in it and that made
the child processes respond to SIGTERM properly.  The modification
didn't stop the abnormally high CPU consumption.

With AIX, making that modification didn't help any.

On both platforms I see the "server reach MaxClients setting" a few
seconds after startup, but no requests have been issued yet.

I don't understand exactly what is happening on either system.  I'm
missing a truss/strace-like program on both systems and don't know
what it would tell me about threads anyway.

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

Re: threaded MPM and the signal thread

Posted by Jeff Trawick <tr...@bellsouth.net>.
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...

Re: threaded MPM and the signal thread

Posted by Jeff Trawick <tr...@bellsouth.net>.
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...