httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@apache.org
Subject cvs commit: httpd-2.0/server log.c
Date Sat, 15 Feb 2003 01:21:31 GMT
trawick     2003/02/14 17:21:31

  Modified:    .        Tag: APACHE_2_0_BRANCH STATUS CHANGES
               server   Tag: APACHE_2_0_BRANCH log.c
  Log:
  merge the fix for 15761 into 2.0.45-dev
  
  (nice to test one more time :)
  
  code bogus pipe pgm for ErrorLog
  ./httpd
  (shell message for SIGPIPE)
  make
  ./httpd
  (nicely formatted message from Apache)
  
  PR: 15761
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.751.2.87 +1 -5      httpd-2.0/STATUS
  
  Index: STATUS
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/STATUS,v
  retrieving revision 1.751.2.86
  retrieving revision 1.751.2.87
  diff -u -r1.751.2.86 -r1.751.2.87
  --- STATUS	15 Feb 2003 01:02:59 -0000	1.751.2.86
  +++ STATUS	15 Feb 2003 01:21:30 -0000	1.751.2.87
  @@ -100,10 +100,6 @@
         [ This one is under review.  Don't merge.  ]
         +1:
   
  -    * Better report problems with piped log processes (PR 15761)
  -      server/log.c: r1.129 and r1.130
  -      +1: trawick, nd, jerenkrantz
  -
       * Better report problems with external scripts
         modules/filters/mod_ext_filter.c: r1.4
         modules/generators/mod_cgi.c: r1.151
  
  
  
  1.988.2.34 +9 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.988.2.33
  retrieving revision 1.988.2.34
  diff -u -r1.988.2.33 -r1.988.2.34
  --- CHANGES	15 Feb 2003 01:02:59 -0000	1.988.2.33
  +++ CHANGES	15 Feb 2003 01:21:31 -0000	1.988.2.34
  @@ -1,5 +1,14 @@
   Changes with Apache 2.0.45
   
  +  *) Try to log an error if a piped log program fails.  Try to
  +     restart a piped log program in more failure situations.  Fix an
  +     existing problem with error handling in piped_log_spawn().  Use
  +     new APR apr_proc_create() features to prevent Apache from starting
  +     on Unix* in most cases where a piped log program can be started,
  +     and add log messages for the other situations.  *Other platforms
  +     already failed Apache initialization if a piped log program
  +     couldn't be started.  PR 15761  [Jeff Trawick]
  +
     *) Fix mod_cern_meta to not create empty metafiles when the
        metafile searched for does not exist.  PR 12353
        [Owen Rees <owen_rees@hp.com>]
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.127.2.2 +30 -18    httpd-2.0/server/log.c
  
  Index: log.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/log.c,v
  retrieving revision 1.127.2.1
  retrieving revision 1.127.2.2
  diff -u -r1.127.2.1 -r1.127.2.2
  --- log.c	3 Feb 2003 17:32:00 -0000	1.127.2.1
  +++ log.c	15 Feb 2003 01:21:31 -0000	1.127.2.2
  @@ -220,6 +220,13 @@
       return rc;
   }
   
  +static void log_child_errfn(apr_pool_t *pool, apr_status_t err,
  +                            const char *description)
  +{
  +    ap_log_error(APLOG_MARK, APLOG_ERR, err, NULL,
  +                 "%s", description);
  +}
  +
   static int log_child(apr_pool_t *p, const char *progname,
                        apr_file_t **fpin)
   {
  @@ -235,7 +242,9 @@
           && ((rc = apr_procattr_io_set(procattr,
                                         APR_FULL_BLOCK,
                                         APR_NO_PIPE,
  -                                      APR_NO_PIPE)) == APR_SUCCESS)) {
  +                                      APR_NO_PIPE)) == APR_SUCCESS)
  +        && ((rc = apr_procattr_error_check_set(procattr, 1)) == APR_SUCCESS)
  +        && ((rc = apr_procattr_child_errfn_set(procattr, log_child_errfn)) == APR_SUCCESS))
{
           char **args;
           const char *pname;
   
  @@ -725,7 +734,7 @@
   
   static int piped_log_spawn(piped_log *pl)
   {
  -    int rc;
  +    int rc = 0;
       apr_procattr_t *procattr;
       apr_proc_t *procnew = NULL;
       apr_status_t status;
  @@ -734,7 +743,10 @@
           ((status = apr_procattr_child_in_set(procattr,
                                                ap_piped_log_read_fd(pl),
                                                ap_piped_log_write_fd(pl)))
  -        != APR_SUCCESS)) {
  +        != APR_SUCCESS) ||
  +        ((status = apr_procattr_child_errfn_set(procattr, log_child_errfn))
  +         != APR_SUCCESS) ||
  +        ((status = apr_procattr_error_check_set(procattr, 1)) != APR_SUCCESS)) {
           char buf[120];
           /* Something bad happened, give up and go away. */
           ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
  @@ -749,22 +761,26 @@
           apr_tokenize_to_argv(pl->program, &args, pl->p);
           pname = apr_pstrdup(pl->p, args[0]);
           procnew = apr_pcalloc(pl->p, sizeof(apr_proc_t));
  -        rc = apr_proc_create(procnew, pname, (const char * const *) args,
  -                             NULL, procattr, pl->p);
  +        status = apr_proc_create(procnew, pname, (const char * const *) args,
  +                                 NULL, procattr, pl->p);
   
  -        if (rc == APR_SUCCESS) {
  -            /* pjr - This no longer happens inside the child, */
  -            /*   I am assuming that if apr_proc_create was  */
  -            /*   successful that the child is running.        */
  -            RAISE_SIGSTOP(PIPED_LOG_SPAWN);
  +        if (status == APR_SUCCESS) {
               pl->pid = procnew;
               ap_piped_log_write_fd(pl) = procnew->in;
               apr_proc_other_child_register(procnew, piped_log_maintenance, pl,
                                             ap_piped_log_write_fd(pl), pl->p);
           }
  +        else {
  +            char buf[120];
  +            /* Something bad happened, give up and go away. */
  +            ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
  +                         "unable to start piped log program '%s': %s",
  +                         pl->program, apr_strerror(status, buf, sizeof(buf)));
  +            rc = -1;
  +        }
       }
   
  -    return 0;
  +    return rc;
   }
   
   
  @@ -775,14 +791,10 @@
   
       switch (reason) {
       case APR_OC_REASON_DEATH:
  -        pl->pid = NULL;
  -        apr_proc_other_child_unregister(pl);
  -        if (pl->program == NULL) {
  -            /* during a restart */
  -            break;
  -        }
  -        break;
       case APR_OC_REASON_LOST:
  +        ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL,
  +                     "piped log program '%s' failed unexpectedly",
  +                     pl->program);
           pl->pid = NULL;
           apr_proc_other_child_unregister(pl);
           if (pl->program == NULL) {
  
  
  

Mime
View raw message