manoj       99/08/10 14:18:46

  Modified:    mpm/src/modules/mpm/dexter dexter.c
               mpm/src/modules/mpm/mpmt_pthread mpmt_pthread.c
  Log:
  Put back the process_child_status code from 1.3. Handling of synchronous
  signals like SEGV and FPE is still a bit dodgy, though, so this won't
  accomplish much by itself.
  
  Revision  Changes    Path
  1.19      +53 -0     apache-2.0/mpm/src/modules/mpm/dexter/dexter.c
  
  Index: dexter.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/mpm/src/modules/mpm/dexter/dexter.c,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -d -u -r1.18 -r1.19
  --- dexter.c  1999/08/05 19:56:15     1.18
  +++ dexter.c  1999/08/10 21:18:37     1.19
  @@ -744,6 +744,57 @@
   
   #endif
   }
  +
  +static void process_child_status(int pid, ap_wait_t status)
  +{
  +    /* Child died... if it died due to a fatal error,
  +     * we should simply bail out.
  +     */
  +    if ((WIFEXITED(status)) &&
  +     WEXITSTATUS(status) == APEXIT_CHILDFATAL) {
  +     ap_log_error(APLOG_MARK, APLOG_ALERT|APLOG_NOERRNO, server_conf,
  +                     "Child %d returned a Fatal error... \n"
  +                     "Apache is exiting!",
  +                     pid);
  +     exit(APEXIT_CHILDFATAL);
  +    }
  +    if (WIFSIGNALED(status)) {
  +     switch (WTERMSIG(status)) {
  +     case SIGTERM:
  +     case SIGHUP:
  +     case SIGUSR1:
  +     case SIGKILL:
  +         break;
  +     default:
  +#ifdef SYS_SIGLIST
  +#ifdef WCOREDUMP
  +         if (WCOREDUMP(status)) {
  +             ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE,
  +                          server_conf,
  +                          "child pid %d exit signal %s (%d), "
  +                          "possible coredump in %s",
  +                          pid, (WTERMSIG(status) >= NumSIG) ? "" : 
  +                          SYS_SIGLIST[WTERMSIG(status)], WTERMSIG(status),
  +                          ap_coredump_dir);
  +         }
  +         else {
  +#endif
  +             ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE,
  +                          server_conf,
  +                          "child pid %d exit signal %s (%d)", pid,
  +                          SYS_SIGLIST[WTERMSIG(status)], WTERMSIG(status));
  +#ifdef WCOREDUMP
  +         }
  +#endif
  +#else
  +         ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE,
  +                      server_conf,
  +                      "child pid %d exit signal %d",
  +                      pid, WTERMSIG(status));
  +#endif
  +     }
  +    }
  +}
    
   static int setup_listeners(pool *pconf, server_rec *s)
   {
  @@ -1253,6 +1304,8 @@
           pid = wait_or_timeout(&status);
           
           if (pid >= 0) {
  +            process_child_status(pid, status);
  +            /* non-fatal death... note that it's gone in the scoreboard. */
               child_slot = find_child_by_pid(pid);
               if (child_slot >= 0) {
                   ap_update_child_status(child_slot, SERVER_DEAD);
  
  
  
  1.24      +54 -1     
apache-2.0/mpm/src/modules/mpm/mpmt_pthread/mpmt_pthread.c
  
  Index: mpmt_pthread.c
  ===================================================================
  RCS file: 
/home/cvs/apache-2.0/mpm/src/modules/mpm/mpmt_pthread/mpmt_pthread.c,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -d -u -r1.23 -r1.24
  --- mpmt_pthread.c    1999/08/05 19:56:19     1.23
  +++ mpmt_pthread.c    1999/08/10 21:18:43     1.24
  @@ -568,7 +568,7 @@
   {
       chdir(ap_coredump_dir);
       signal(sig, SIG_DFL);
  -    kill(getpid(), sig);
  +    kill(my_pid, sig);
       /* At this point we've got sig blocked, because we're still inside
        * the signal handler.  When we leave the signal handler it will
        * be unblocked, and we'll take the signal... and coredump or whatever
  @@ -752,6 +752,57 @@
   
   #endif
   }
  +
  +static void process_child_status(int pid, ap_wait_t status)
  +{
  +    /* Child died... if it died due to a fatal error,
  +     * we should simply bail out.
  +     */
  +    if ((WIFEXITED(status)) &&
  +     WEXITSTATUS(status) == APEXIT_CHILDFATAL) {
  +     ap_log_error(APLOG_MARK, APLOG_ALERT|APLOG_NOERRNO, server_conf,
  +                     "Child %d returned a Fatal error... \n"
  +                     "Apache is exiting!",
  +                     pid);
  +     exit(APEXIT_CHILDFATAL);
  +    }
  +    if (WIFSIGNALED(status)) {
  +     switch (WTERMSIG(status)) {
  +     case SIGTERM:
  +     case SIGHUP:
  +     case SIGUSR1:
  +     case SIGKILL:
  +         break;
  +     default:
  +#ifdef SYS_SIGLIST
  +#ifdef WCOREDUMP
  +         if (WCOREDUMP(status)) {
  +             ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE,
  +                          server_conf,
  +                          "child pid %d exit signal %s (%d), "
  +                          "possible coredump in %s",
  +                          pid, (WTERMSIG(status) >= NumSIG) ? "" : 
  +                          SYS_SIGLIST[WTERMSIG(status)], WTERMSIG(status),
  +                          ap_coredump_dir);
  +         }
  +         else {
  +#endif
  +             ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE,
  +                          server_conf,
  +                          "child pid %d exit signal %s (%d)", pid,
  +                          SYS_SIGLIST[WTERMSIG(status)], WTERMSIG(status));
  +#ifdef WCOREDUMP
  +         }
  +#endif
  +#else
  +         ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE,
  +                      server_conf,
  +                      "child pid %d exit signal %d",
  +                      pid, WTERMSIG(status));
  +#endif
  +     }
  +    }
  +}
    
   static int setup_listeners(pool *pconf, server_rec *s)
   {
  @@ -1296,6 +1347,8 @@
           pid = wait_or_timeout(&status);
           
           if (pid >= 0) {
  +            process_child_status(pid, status);
  +            /* non-fatal death... note that it's gone in the scoreboard. */
               child_slot = find_child_by_pid(pid);
               if (child_slot >= 0) {
                   for (i = 0; i < ap_threads_per_child; i++)
  
  
  

Reply via email to