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/mpm/worker worker.c
Date Mon, 28 Jan 2002 00:41:32 GMT
trawick     02/01/27 16:41:32

  Modified:    .        CHANGES STATUS
               include  ap_mmn.h scoreboard.h
               server   scoreboard.c
               server/mpm/beos beos.c
               server/mpm/netware mpm_netware.c
               server/mpm/perchild perchild.c
               server/mpm/prefork prefork.c
               server/mpm/winnt mpm_winnt.c
               server/mpm/worker worker.c
  Log:
  fix the problem where a scoreboard init failure could leave
  mod_cgid stranded
  
  a pre_mpm hook can now return failures, so problems in
  ap_create_scoreboard percolate back to a place where Apache
  can exit cleanly
  
  Revision  Changes    Path
  1.541     +5 -0      httpd-2.0/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/CHANGES,v
  retrieving revision 1.540
  retrieving revision 1.541
  diff -u -r1.540 -r1.541
  --- CHANGES	27 Jan 2002 12:52:06 -0000	1.540
  +++ CHANGES	28 Jan 2002 00:41:30 -0000	1.541
  @@ -1,4 +1,9 @@
   Changes with Apache 2.0.31-dev
  +
  +  *) Change the pre_mpm hook to return a value, so that scoreboard
  +     init errors percolate up to code that knows how to exit 
  +     cleanly.  This required bump to the MMN.  [Jeff Trawick]
  +
     *) Add the socket back to the conn_rec and remove the create_connection
        hook. The create_connection hook had a design flaw that did not 
        allow creating connections based on vhost info. [Bill Stoddard]
  
  
  
  1.404     +1 -6      httpd-2.0/STATUS
  
  Index: STATUS
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/STATUS,v
  retrieving revision 1.403
  retrieving revision 1.404
  diff -u -r1.403 -r1.404
  --- STATUS	27 Jan 2002 08:11:09 -0000	1.403
  +++ STATUS	28 Jan 2002 00:41:31 -0000	1.404
  @@ -1,5 +1,5 @@
   APACHE 2.0 STATUS:						-*-text-*-
  -Last modified at [$Date: 2002/01/27 08:11:09 $]
  +Last modified at [$Date: 2002/01/28 00:41:31 $]
   
   Release:
   
  @@ -91,11 +91,6 @@
                   LOCKALL and CROSS_PROCESS are not yet complete on all
                   platforms, and should only be used in MPMs like worker
                   with limited OS exposure.
  -
  -    * ap_create_scoreboard() can exit the process, leaving stuff like
  -      mod_cgid's daemon process stranded.  Either ap_create_scoreboard()
  -      needs to be called at a different time or the pre-mpm hook needs
  -      to be able to return an error code.
   
       * A binbuild installation picks up the right libraries when
         running apachectl because we set the appropriate environment
  
  
  
  1.30      +1 -0      httpd-2.0/include/ap_mmn.h
  
  Index: ap_mmn.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/include/ap_mmn.h,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- ap_mmn.h	19 Jan 2002 07:45:16 -0000	1.29
  +++ ap_mmn.h	28 Jan 2002 00:41:31 -0000	1.30
  @@ -93,6 +93,7 @@
    * 20020114 (2.0.31-dev) mod_dav changed how it asks its provider to fulfill
    *                       a GET request
    * 20020118 (2.0.31-dev) Input filtering split of blocking and mode
  + * 20020127 (2.0.31-dev) bump for pre_mpm hook change
    */
   
   #define MODULE_MAGIC_COOKIE 0x41503230UL /* "AP20" */
  
  
  
  1.38      +3 -2      httpd-2.0/include/scoreboard.h
  
  Index: scoreboard.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/include/scoreboard.h,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- scoreboard.h	10 Jan 2002 00:28:00 -0000	1.37
  +++ scoreboard.h	28 Jan 2002 00:41:31 -0000	1.38
  @@ -184,7 +184,7 @@
   AP_DECLARE(int) ap_exists_scoreboard_image(void);
   AP_DECLARE(void) ap_increment_counts(ap_sb_handle_t *sbh, request_rec *r);
   
  -void ap_create_scoreboard(apr_pool_t *p, ap_scoreboard_e t);
  +int ap_create_scoreboard(apr_pool_t *p, ap_scoreboard_e t);
   apr_status_t reopen_scoreboard(apr_pool_t *p, int detached);
   void ap_init_scoreboard(void *shared_score);
   int ap_calc_scoreboard_size(void);
  @@ -218,8 +218,9 @@
     * @param p       Apache pool to allocate from.
     * @param sb_type 
     * @ingroup hooks
  +  * @return OK or DECLINE on success; anything else is a error
     */  
  -AP_DECLARE_HOOK(void, pre_mpm, (apr_pool_t *p, ap_scoreboard_e sb_type))
  +AP_DECLARE_HOOK(int, pre_mpm, (apr_pool_t *p, ap_scoreboard_e sb_type))
   
   /* for time_process_request() in http_main.c */
   #define START_PREQUEST 1
  
  
  
  1.52      +8 -7      httpd-2.0/server/scoreboard.c
  
  Index: scoreboard.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/scoreboard.c,v
  retrieving revision 1.51
  retrieving revision 1.52
  diff -u -r1.51 -r1.52
  --- scoreboard.c	25 Jan 2002 12:04:56 -0000	1.51
  +++ scoreboard.c	28 Jan 2002 00:41:31 -0000	1.52
  @@ -99,9 +99,9 @@
       APR_HOOK_LINK(pre_mpm)
   )
    
  -AP_IMPLEMENT_HOOK_VOID(pre_mpm,
  -                       (apr_pool_t *p, ap_scoreboard_e sb_type),
  -                       (p, sb_type))
  +AP_IMPLEMENT_HOOK_RUN_ALL(int,pre_mpm,
  +                          (apr_pool_t *p, ap_scoreboard_e sb_type),
  +                          (p, sb_type),OK,DECLINED)
   
   struct ap_sb_handle_t {
       int child_num;
  @@ -237,7 +237,7 @@
   /* Create or reinit an existing scoreboard. The MPM can control whether
    * the scoreboard is shared across multiple processes or not
    */
  -void ap_create_scoreboard(apr_pool_t *p, ap_scoreboard_e sb_type)
  +int ap_create_scoreboard(apr_pool_t *p, ap_scoreboard_e sb_type)
   {
       int running_gen = 0;
   #if APR_HAS_SHARED_MEMORY
  @@ -255,7 +255,7 @@
               void *sb_shared;
               rv = open_scoreboard(p);
               if (rv || !(sb_shared = apr_shm_baseaddr_get(ap_scoreboard_shm))) {
  -                exit(APEXIT_INIT); /* XXX need to return an error from this function */
  +                return HTTP_INTERNAL_SERVER_ERROR;
               }
               memset(sb_shared, 0, scoreboard_size);
               ap_init_scoreboard(sb_shared);
  @@ -264,7 +264,7 @@
               void *sb_shared;
               rv = reopen_scoreboard(p, 1);
               if (rv || !(sb_shared = apr_shm_baseaddr_get(ap_scoreboard_shm))) {
  -                exit(APEXIT_INIT); /* XXX need to return an error from this function */
  +                return HTTP_INTERNAL_SERVER_ERROR;
               }
               ap_init_scoreboard(sb_shared);
           }
  @@ -277,7 +277,7 @@
                   ap_log_error(APLOG_MARK, APLOG_CRIT | APLOG_NOERRNO, 0, NULL,
                                "(%d)%s: cannot allocate scoreboard",
                                errno, strerror(errno));
  -                exit(APEXIT_INIT); /* XXX need to return an error from this function */
  +                return HTTP_INTERNAL_SERVER_ERROR;
               }
               ap_init_scoreboard(sb_mem);
           }
  @@ -290,6 +290,7 @@
                                     apr_pool_cleanup_null);
       }
       ap_restart_time = apr_time_now();
  +    return OK;
   }
   
   /* Routines called to deal with the scoreboard image
  
  
  
  1.79      +3 -1      httpd-2.0/server/mpm/beos/beos.c
  
  Index: beos.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/beos/beos.c,v
  retrieving revision 1.78
  retrieving revision 1.79
  diff -u -r1.78 -r1.79
  --- beos.c	27 Jan 2002 12:52:07 -0000	1.78
  +++ beos.c	28 Jan 2002 00:41:31 -0000	1.79
  @@ -837,7 +837,9 @@
       
       if (!is_graceful) {
           /* setup the scoreboard shared memory */
  -        ap_run_pre_mpm(pconf, SB_SHARED);
  +        if (ap_run_pre_mpm(pconf, SB_SHARED) != OK) {
  +            return 1;
  +        }
   
           for (i = 0; i < HARD_SERVER_LIMIT; i++) {
               ap_scoreboard_image->parent[i].pid = 0;
  
  
  
  1.26      +3 -1      httpd-2.0/server/mpm/netware/mpm_netware.c
  
  Index: mpm_netware.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/netware/mpm_netware.c,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- mpm_netware.c	27 Jan 2002 12:52:07 -0000	1.25
  +++ mpm_netware.c	28 Jan 2002 00:41:31 -0000	1.26
  @@ -881,7 +881,9 @@
       apr_thread_mutex_create(&accept_mutex, APR_THREAD_MUTEX_DEFAULT, pconf);
   
       if (!is_graceful) {
  -        ap_run_pre_mpm(pconf, SB_NOT_SHARED);
  +        if (ap_run_pre_mpm(pconf, SB_NOT_SHARED) != OK) {
  +            return 1;
  +        }
       }
   
       /* Only set slot 0 since that is all NetWare will ever have. */
  
  
  
  1.102     +3 -1      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.101
  retrieving revision 1.102
  diff -u -r1.101 -r1.102
  --- perchild.c	27 Jan 2002 12:52:08 -0000	1.101
  +++ perchild.c	28 Jan 2002 00:41:31 -0000	1.102
  @@ -1305,7 +1305,9 @@
       }
   
       if (!is_graceful) {
  -        ap_run_pre_mpm(pconf, SB_SHARED);
  +        if (ap_run_pre_mpm(pconf, SB_SHARED) != OK) {
  +            return 1;
  +        }
       }
       /* Initialize the child table */
       if (!is_graceful) {
  
  
  
  1.232     +3 -1      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.231
  retrieving revision 1.232
  diff -u -r1.231 -r1.232
  --- prefork.c	27 Jan 2002 12:52:08 -0000	1.231
  +++ prefork.c	28 Jan 2002 00:41:31 -0000	1.232
  @@ -1001,7 +1001,9 @@
   
       SAFE_ACCEPT(accept_mutex_init(pconf));
       if (!is_graceful) {
  -        ap_run_pre_mpm(pconf, SB_SHARED);
  +        if (ap_run_pre_mpm(pconf, SB_SHARED) != OK) {
  +            return 1;
  +        }
       }
   #ifdef SCOREBOARD_FILE
       else {
  
  
  
  1.211     +9 -3      httpd-2.0/server/mpm/winnt/mpm_winnt.c
  
  Index: mpm_winnt.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/mpm/winnt/mpm_winnt.c,v
  retrieving revision 1.210
  retrieving revision 1.211
  diff -u -r1.210 -r1.211
  --- mpm_winnt.c	27 Jan 2002 12:52:08 -0000	1.210
  +++ mpm_winnt.c	28 Jan 2002 00:41:32 -0000	1.211
  @@ -2101,7 +2101,9 @@
   
           if (one_process) {
               /* Set up the scoreboard. */
  -            ap_run_pre_mpm(pconf, SB_SHARED);
  +            if (ap_run_pre_mpm(pconf, SB_SHARED) != OK) {
  +                return 1;
  +            }
               if (ap_setup_listeners(ap_server_conf) < 1) {
                   return 1;
               }
  @@ -2130,7 +2132,9 @@
                   exit(1);
               }
   
  -            ap_run_pre_mpm(pconf, SB_SHARED_CHILD);
  +            if (ap_run_pre_mpm(pconf, SB_SHARED_CHILD) != OK) {
  +                exit(1);
  +            }
               ap_my_generation = atoi(getenv("AP_MY_GENERATION"));
               get_listeners_from_parent(ap_server_conf);
           }
  @@ -2148,7 +2152,9 @@
       }
       else /* Child */ { 
           /* Set up the scoreboard. */
  -        ap_run_pre_mpm(pconf, SB_SHARED);
  +        if (ap_run_pre_mpm(pconf, SB_SHARED) != OK) {
  +            return 1;
  +        }
   
           /* Parent process */
           if (ap_setup_listeners(ap_server_conf) < 1) {
  
  
  
  1.62      +6 -1      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.61
  retrieving revision 1.62
  diff -u -r1.61 -r1.62
  --- worker.c	27 Jan 2002 12:52:08 -0000	1.61
  +++ worker.c	28 Jan 2002 00:41:32 -0000	1.62
  @@ -1422,7 +1422,9 @@
       }
   
       if (!is_graceful) {
  -        ap_run_pre_mpm(pconf, SB_SHARED);
  +        if (ap_run_pre_mpm(pconf, SB_SHARED) != OK) {
  +            return 1;
  +        }
       }
   
       set_signals();
  @@ -1709,6 +1711,9 @@
                       ap_daemons_limit);
          max_clients = ap_daemons_limit * ap_threads_per_child; 
       }
  +    /* XXX
  +     * ap_daemons_limit can reach server_limit * ap_threads_per_child, right?
  +     */
       if (ap_daemons_limit > server_limit) {
          ap_log_error(APLOG_MARK, APLOG_STARTUP | APLOG_NOERRNO, 0, NULL, 
                       "WARNING: MaxClients of %d would require %d servers,",
  
  
  

Mime
View raw message