httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@apache.org
Subject cvs commit: apache-1.3/src/main http_main.c
Date Fri, 23 May 2003 15:25:25 GMT
trawick     2003/05/23 08:25:25

  Modified:    src      CHANGES
               src/main http_main.c
  Log:
  Make sure the accept mutex is released before calling child exit
  hooks and cleanups.  Otherwise, modules can segfault in such code
  and, with pthread mutexes, leave the server deadlocked.  Even if
  the module doesn't segfault, if it performs extensive processing
  it can temporarily prevent the server from accepting new
  connections.
  
  Reviewed by:	Jim, FirstBill
  
  Revision  Changes    Path
  1.1894    +7 -0      apache-1.3/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/CHANGES,v
  retrieving revision 1.1893
  retrieving revision 1.1894
  diff -u -r1.1893 -r1.1894
  --- CHANGES	19 May 2003 02:35:30 -0000	1.1893
  +++ CHANGES	23 May 2003 15:25:22 -0000	1.1894
  @@ -1,5 +1,12 @@
   Changes with Apache 1.3.28
   
  +  *) Make sure the accept mutex is released before calling child exit
  +     hooks and cleanups.  Otherwise, modules can segfault in such code
  +     and, with pthread mutexes, leave the server deadlocked.  Even if
  +     the module doesn't segfault, if it performs extensive processing
  +     it can temporarily prevent the server from accepting new
  +     connections.  [Jeff Trawick]
  +
     *) Fix mod_rewrite's handling of absolute URIs. The escaping routines
        now work scheme dependent and the query string will only be
        appended if supported by the particular scheme.  [André Malo]
  
  
  
  1.604     +15 -1     apache-1.3/src/main/http_main.c
  
  Index: http_main.c
  ===================================================================
  RCS file: /home/cvs/apache-1.3/src/main/http_main.c,v
  retrieving revision 1.603
  retrieving revision 1.604
  diff -u -r1.603 -r1.604
  --- http_main.c	9 May 2003 19:05:49 -0000	1.603
  +++ http_main.c	23 May 2003 15:25:24 -0000	1.604
  @@ -372,6 +372,7 @@
   static pool *plog;		/* Pool for error-logging files */
   static pool *ptrans;		/* Pool for per-transaction stuff */
   static pool *pchild;		/* Pool for httpd child stuff */
  +static pool *pmutex;            /* Pool for accept mutex in child */
   static pool *pcommands;	/* Pool for -C and -c switches */
   
   #ifndef NETWARE
  @@ -515,6 +516,14 @@
   static void clean_child_exit(int code)
   {
       if (pchild) {
  +        /* make sure the accept mutex is released before calling child
  +         * exit hooks and cleanups...  otherwise, modules can segfault
  +         * in such code and, depending on the mutex mechanism, leave
  +         * the server deadlocked...  even if the module doesn't segfault,
  +         * if it performs extensive processing it can temporarily prevent
  +         * the server from accepting new connections
  +         */
  +        ap_clear_pool(pmutex);
   	ap_child_exit_modules(pchild, server_conf);
   	ap_destroy_pool(pchild);
       }
  @@ -4255,10 +4264,15 @@
        * we can have cleanups occur when the child exits.
        */
       pchild = ap_make_sub_pool(pconf);
  +    /* associate accept mutex cleanup with a subpool of pchild so we can
  +     * make sure the mutex is released before calling module code at
  +     * termination
  +     */
  +    pmutex = ap_make_sub_pool(pchild);
   
       /* needs to be done before we switch UIDs so we have permissions */
       reopen_scoreboard(pchild);
  -    SAFE_ACCEPT(accept_mutex_child_init(pchild));
  +    SAFE_ACCEPT(accept_mutex_child_init(pmutex));
   
       set_group_privs();
   #ifdef MPE
  
  
  

Mime
View raw message