]> granicus.if.org Git - apache/commitdiff
perchild MPM: Fix thread safety problem in the use of longjmp().
authorJeff Trawick <trawick@apache.org>
Sat, 31 Jul 2004 20:47:49 +0000 (20:47 +0000)
committerJeff Trawick <trawick@apache.org>
Sat, 31 Jul 2004 20:47:49 +0000 (20:47 +0000)
Submitted by:   Tsuyoshi SASAMOTO <nazonazo super.win.ne.jp>
Reviewed by: Jeff Trawick

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@104436 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
server/mpm/experimental/perchild/perchild.c

diff --git a/CHANGES b/CHANGES
index 5f2890ea217b9ab0d42a3756d4d9a37b0516cda7..0099764a404628d3f5706f12a557a4c7178f815d 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,9 @@ Changes with Apache 2.1.0-dev
 
   [Remove entries to the current 2.0 section below, when backported]
 
+  *) perchild MPM: Fix thread safety problem in the use of longjmp().
+     [Tsuyoshi SASAMOTO <nazonazo super.win.ne.jp>]
+
   *) Add load balancer support to the scoreboard in preparation for
      load balancing support in mod_proxy. [Mladen Turk]
 
index 5e3522546b6be7983cc1a0a77a0d51b4ad6318a8..c2bd609dca8bf42e9f3119604bc770030bbbea87 100644 (file)
@@ -137,7 +137,7 @@ static int workers_may_exit = 0;
 static int requests_this_child;
 static int num_listensocks = 0;
 static ap_pod_t *pod;
-static jmp_buf jmpbuffer;
+static jmp_buf *jmpbuffers;
 
 struct child_info_t {
     uid_t uid;
@@ -758,7 +758,7 @@ static void *worker_thread(apr_thread_t *thd, void *arg)
                 }
             }
             apr_thread_mutex_unlock(idle_thread_count_mutex);
-            if (setjmp(jmpbuffer) != 1) {
+            if (setjmp(jmpbuffers[thread_num]) != 1) {
                 process_socket(ptrans, csd, conn_id, bucket_alloc);
             }
             else {
@@ -1668,6 +1668,8 @@ static int perchild_post_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *pte
     }
     ap_child_table = (ap_ctable *)apr_pcalloc(p, server_limit * sizeof(ap_ctable));
 
+    jmpbuffers = (jmp_buf *)apr_palloc(p, thread_limit * sizeof(jmp_buf));
+
     return OK;
 }
 
@@ -1704,7 +1706,7 @@ static int perchild_post_read(request_rec *r)
                              ap_server_conf, "Could not pass request to proper "
                              "child, request will not be honored.");
             }
-            longjmp(jmpbuffer, 1); 
+            longjmp(jmpbuffers[thread_num], 1); 
         }
         return OK;
     }