|
Index: src/main/http_main.c
===================================================================
RCS file: /home/cvs/apache-1.3/src/main/http_main.c,v
retrieving revision 1.602
diff -u -r1.602 http_main.c
--- src/main/http_main.c 25 Apr 2003 13:50:23 -0000 1.602
+++ src/main/http_main.c 9 May 2003 14:35:32 -0000
@@ -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);
}
@@ -4211,10 +4220,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
|