httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@apache.org
Subject cvs commit: httpd-2.0/server/mpm/worker worker.c
Date Mon, 04 Feb 2002 18:41:46 GMT
rbb         02/02/04 10:41:46

  Modified:    .        CHANGES STATUS
               server/mpm/perchild perchild.c
               server/mpm/prefork prefork.c
               server/mpm/worker worker.c
  Log:
  Not being able to bind to a socket is a fatal error.  This makes all
  MPMs treat it as such.  We now print a message to the console, and return
  a non-zero status code.
  
  Revision  Changes    Path
  1.563     +5 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.562
  retrieving revision 1.563
  diff -u -r1.562 -r1.563
  --- CHANGES	4 Feb 2002 15:18:44 -0000	1.562
  +++ CHANGES	4 Feb 2002 18:41:45 -0000	1.563
  @@ -1,5 +1,10 @@
   Changes with Apache 2.0.32-dev
   
  +  *) Not being able to bind to the socket is a fatal error.  We should
  +     print an error to the console, and return a non-zero status code.
  +     With these changes, all of the Unix MPMs do that correctly.
  +     [Ryan Bloom]
  +
     *) suexec: Allow HTTPS and SSL_* environment variables to be passed
        through to CGI scripts. PR 9163
        [Brian Reid <breid@customlogic.com>, 
  
  
  
  1.452     +1 -15     httpd-2.0/STATUS
  
  Index: STATUS
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/STATUS,v
  retrieving revision 1.451
  retrieving revision 1.452
  diff -u -r1.451 -r1.452
  --- STATUS	4 Feb 2002 17:40:32 -0000	1.451
  +++ STATUS	4 Feb 2002 18:41:45 -0000	1.452
  @@ -1,5 +1,5 @@
   APACHE 2.0 STATUS:						-*-text-*-
  -Last modified at [$Date: 2002/02/04 17:40:32 $]
  +Last modified at [$Date: 2002/02/04 18:41:45 $]
   
   Release:
   
  @@ -147,20 +147,6 @@
                   libapr/libaprutil/etc and then enable it in binbuild.
   
   RELEASE NON-SHOWSTOPPERS BUT WOULD BE REAL NICE TO WRAP THESE UP:
  -
  -    * Runtime startup failures don't reliably set the exit status.
  -      For instance, try listening to port 80 and starting as non-root;
  -      server fails with make_sock and 'no listening sockets' errors
  -      but exits with 0 status.  Even with -DONE_PROCESS -DNO_DETACH.
  -        Justin says: "Is this really a showstopper?  Most people won't
  -                      be using -DNO_DETACH and will look at the error
  -                      logs anyway."
  -        Ken says: "Yes, it's a showstopper -- because it exits with
  -                  a 0 status on startup failure, whether it spawns
  -                  or not, before doing any work.  A script will
  -                  incorrectly think it successfully daemonised."
  -        Showstopper: Ken, BrianP, Martin
  -        Not a showstopper: trawick, stoddard, Jim, Justin, Aaron
   
       * The Add...Filter and Set...Filter directives do not allow the
         administrator to order filters, beyond the order of filename (mime)
  
  
  
  1.107     +34 -3     httpd-2.0/server/mpm/perchild/perchild.c
  
  Index: perchild.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/perchild/perchild.c,v
  retrieving revision 1.106
  retrieving revision 1.107
  diff -u -r1.106 -r1.107
  --- perchild.c	1 Feb 2002 22:16:31 -0000	1.106
  +++ perchild.c	4 Feb 2002 18:41:46 -0000	1.107
  @@ -1257,8 +1257,8 @@
       apr_status_t rv;
       apr_size_t one = 1;
   
  -    pconf = _pconf;
  -    ap_server_conf = s;
  +    ap_log_pid(pconf, ap_pid_fname);
  +
       first_server_limit = server_limit;
       first_thread_limit = thread_limit;
       if (changed_limit_at_restart) {
  @@ -1289,7 +1289,6 @@
                        "no listening sockets available, shutting down");
           return 1;
       }
  -    ap_log_pid(pconf, ap_pid_fname);
   
       /* Initialize cross-process accept lock */
       ap_lock_fname = apr_psprintf(_pconf, "%s.%u",
  @@ -1424,6 +1423,32 @@
       return 0;
   }
   
  +/* This really should be a post_config hook, but the error log is already
  + * redirected by that point, so we need to do this in the open_logs phase.
  + */
  +static int perchild_open_logs(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec
*s)
  +{
  +    apr_status_t rv;
  +
  +    pconf = p;
  +    ap_server_conf = s;
  +
  +    if ((num_listensocks = ap_setup_listeners(ap_server_conf)) < 1) {
  +        ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ALERT|APLOG_STARTUP, 0,
  +                     NULL, "no listening sockets available, shutting down");
  +        return DONE;
  +    }
  +
  +    ap_log_pid(pconf, ap_pid_fname);
  +
  +    if ((rv = ap_mpm_pod_open(pconf, &pod))) {
  +        ap_log_error(APLOG_MARK, APLOG_CRIT|APLOG_STARTUP, rv, NULL,
  +                "Could not open pipe-of-death.");
  +        return DONE;
  +    }
  +    return OK;
  +}
  +
   static int perchild_pre_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp)
   {
       static int restart_num = 0;
  @@ -1709,8 +1734,14 @@
   
   static void perchild_hooks(apr_pool_t *p)
   {
  +    /* The perchild open_logs phase must run before the core's, or stderr
  +     * will be redirected to a file, and the messages won't print to the
  +     * console.
  +     */
  +    static const char *const aszSucc[] = {"core.c", NULL};
       one_process = 0;
   
  +    ap_hook_open_logs(perchild_open_logs, NULL, aszSucc, APR_HOOK_MIDDLE);
       ap_hook_pre_config(perchild_pre_config, NULL, NULL, APR_HOOK_MIDDLE); 
       ap_hook_post_config(perchild_post_config, NULL, NULL, APR_HOOK_MIDDLE); 
       ap_hook_pre_connection(perchild_pre_connection,NULL,NULL, APR_HOOK_MIDDLE);
  
  
  
  1.239     +6 -4      httpd-2.0/server/mpm/prefork/prefork.c
  
  Index: prefork.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/prefork/prefork.c,v
  retrieving revision 1.238
  retrieving revision 1.239
  diff -u -r1.238 -r1.239
  --- prefork.c	4 Feb 2002 16:58:54 -0000	1.238
  +++ prefork.c	4 Feb 2002 18:41:46 -0000	1.239
  @@ -973,6 +973,8 @@
       int index;
       int remaining_children_to_start;
   
  +    ap_log_pid(pconf, ap_pid_fname);
  +
       first_server_limit = server_limit;
       if (changed_limit_at_restart) {
           ap_log_error(APLOG_MARK, APLOG_WARNING | APLOG_NOERRNO, 0, s,
  @@ -1182,7 +1184,6 @@
       return 0;
   }
   
  -
   /* This really should be a post_config hook, but the error log is already
    * redirected by that point, so we need to do this in the open_logs phase.
    */
  @@ -1199,8 +1200,6 @@
   	return DONE;
       }
   
  -    ap_log_pid(pconf, ap_pid_fname);
  -
       if ((rv = ap_mpm_pod_open(pconf, &pod))) {
           ap_log_error(APLOG_MARK, APLOG_CRIT|APLOG_STARTUP, rv, NULL,
   		"Could not open pipe-of-death.");
  @@ -1260,8 +1259,11 @@
   
   static void prefork_hooks(apr_pool_t *p)
   {
  +    /* The prefork open_logs phase must run before the core's, or stderr
  +     * will be redirected to a file, and the messages won't print to the
  +     * console.
  +     */
       static const char *const aszSucc[] = {"core.c", NULL};
  -
   
   #ifdef AUX3
       (void) set42sig();
  
  
  
  1.71      +32 -17    httpd-2.0/server/mpm/worker/worker.c
  
  Index: worker.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/worker/worker.c,v
  retrieving revision 1.70
  retrieving revision 1.71
  diff -u -r1.70 -r1.71
  --- worker.c	1 Feb 2002 22:16:31 -0000	1.70
  +++ worker.c	4 Feb 2002 18:41:46 -0000	1.71
  @@ -1288,8 +1288,8 @@
       int remaining_children_to_start;
       apr_status_t rv;
   
  -    pconf = _pconf;
  -    ap_server_conf = s;
  +    ap_log_pid(pconf, ap_pid_fname);
  +
       first_server_limit = server_limit;
       first_thread_limit = thread_limit;
       if (changed_limit_at_restart) {
  @@ -1299,21 +1299,6 @@
           changed_limit_at_restart = 0;
       }
       
  -    if ((num_listensocks = ap_setup_listeners(ap_server_conf)) < 1) {
  -        /* XXX: hey, what's the right way for the mpm to indicate a fatal error? */
  -        ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ALERT, 0, s,
  -            "no listening sockets available, shutting down");
  -        return 1;
  -    }
  -
  -    if ((rv = ap_mpm_pod_open(pconf, &pod))) {
  -        ap_log_error(APLOG_MARK, APLOG_CRIT, rv, s,
  -                     "Could not open pipe-of-death.");
  -        return 1;
  -    }
  -
  -    ap_log_pid(pconf, ap_pid_fname);
  -
       /* Initialize cross-process accept lock */
       ap_lock_fname = apr_psprintf(_pconf, "%s.%" APR_OS_PROC_T_FMT,
                                    ap_server_root_relative(_pconf, ap_lock_fname),
  @@ -1456,6 +1441,30 @@
       return 0;
   }
   
  +/* This really should be a post_config hook, but the error log is already
  + * redirected by that point, so we need to do this in the open_logs phase.
  + */
  +static int worker_open_logs(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptemp, server_rec
*s)
  +{
  +    apr_status_t rv;
  +
  +    pconf = p;
  +    ap_server_conf = s;
  +
  +    if ((num_listensocks = ap_setup_listeners(ap_server_conf)) < 1) {
  +        ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_ALERT|APLOG_STARTUP, 0,
  +                     NULL, "no listening sockets available, shutting down");
  +        return DONE;
  +    }
  +
  +    if ((rv = ap_mpm_pod_open(pconf, &pod))) {
  +        ap_log_error(APLOG_MARK, APLOG_CRIT|APLOG_STARTUP, rv, NULL,
  +                "Could not open pipe-of-death.");
  +        return DONE;
  +    }
  +    return OK;
  +}
  +
   static int worker_pre_config(apr_pool_t *pconf, apr_pool_t *plog, 
                                apr_pool_t *ptemp)
   {
  @@ -1546,8 +1555,14 @@
   
   static void worker_hooks(apr_pool_t *p)
   {
  +    /* The worker open_logs phase must run before the core's, or stderr
  +     * will be redirected to a file, and the messages won't print to the
  +     * console.
  +     */
  +    static const char *const aszSucc[] = {"core.c", NULL};
       one_process = 0;
   
  +    ap_hook_open_logs(worker_open_logs, NULL, aszSucc, APR_HOOK_MIDDLE);
       ap_hook_pre_config(worker_pre_config, NULL, NULL, APR_HOOK_MIDDLE);
   }
   
  
  
  

Mime
View raw message