]> granicus.if.org Git - apache/commitdiff
mpm_event,worker: Mask signals for threads created by modules in child init.
authorYann Ylavic <ylavic@apache.org>
Thu, 18 Jan 2018 14:19:28 +0000 (14:19 +0000)
committerYann Ylavic <ylavic@apache.org>
Thu, 18 Jan 2018 14:19:28 +0000 (14:19 +0000)
PR 62009, so that they don't receive (implicitely) the ones meant for the MPM.

Inspired by: Armin Abfalterer <a.abfalterer gmail com>
Proposed by: Yann Ylavic

[Reverted by r1821503]

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

CHANGES
server/mpm/event/event.c
server/mpm/worker/worker.c

diff --git a/CHANGES b/CHANGES
index 910cb3ab44d50069dca18412fc33d8f5fbe38c35..efe57e705cc6b193a50fe7568a576a80913ebf70 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,10 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.1
 
+  *) mpm_event,worker: Mask signals for threads created by modules in child
+     init, so that they don't receive (implicitely) the ones meant for the MPM.
+     PR 62009. [Armin Abfalterer <a.abfalterer gmail.com>, Yann Ylavic]
+
   *) mpm_event: Update scoreboard status for KeepAlive state.  [Yann Ylavic]
 
   *) core, mpm_event: Avoid a small memory leak of the scoreboard handle, for
index 6ccc2084454e392c2306ff43d72980b122a0d4f7..6f57894a8dc05ebea737845b0cd45f2fc0b7687e 100644 (file)
@@ -2663,19 +2663,11 @@ static void child_main(int child_num_arg, int child_bucket)
     /*stuff to do before we switch id's, so we have permissions. */
     ap_reopen_scoreboard(pchild, NULL, 0);
 
+    /* done with init critical section */
     if (ap_run_drop_privileges(pchild, ap_server_conf)) {
         clean_child_exit(APEXIT_CHILDFATAL);
     }
 
-    apr_thread_mutex_create(&g_timer_skiplist_mtx, APR_THREAD_MUTEX_DEFAULT, pchild);
-    APR_RING_INIT(&timer_free_ring, timer_event_t, link);
-    apr_pool_create(&pskip, pchild);
-    apr_skiplist_init(&timer_skiplist, pskip);
-    apr_skiplist_set_compare(timer_skiplist, timer_comp, timer_comp);
-    ap_run_child_init(pchild, ap_server_conf);
-
-    /* done with init critical section */
-
     /* Just use the standard apr_setup_signal_thread to block all signals
      * from being received.  The child processes no longer use signals for
      * any communication with the parent process.
@@ -2687,6 +2679,14 @@ static void child_main(int child_num_arg, int child_bucket)
         clean_child_exit(APEXIT_CHILDFATAL);
     }
 
+    ap_run_child_init(pchild, ap_server_conf);
+
+    apr_thread_mutex_create(&g_timer_skiplist_mtx, APR_THREAD_MUTEX_DEFAULT, pchild);
+    APR_RING_INIT(&timer_free_ring, timer_event_t, link);
+    apr_pool_create(&pskip, pchild);
+    apr_skiplist_init(&timer_skiplist, pskip);
+    apr_skiplist_set_compare(timer_skiplist, timer_comp, timer_comp);
+
     if (ap_max_requests_per_child) {
         conns_this_child = ap_max_requests_per_child;
     }
index 9a971ebd5765cb7d6f71d1e25e673950c8c684d7..9d72f90a467d8cff8911f45cbd71b9c3c1d2a1fa 100644 (file)
@@ -1112,17 +1112,16 @@ static void child_main(int child_num_arg, int child_bucket)
         clean_child_exit(APEXIT_CHILDFATAL);
     }
 
+    /* done with init critical section */
     if (ap_run_drop_privileges(pchild, ap_server_conf)) {
         clean_child_exit(APEXIT_CHILDFATAL);
     }
 
-    ap_run_child_init(pchild, ap_server_conf);
-
-    /* done with init critical section */
-
     /* Just use the standard apr_setup_signal_thread to block all signals
      * from being received.  The child processes no longer use signals for
-     * any communication with the parent process.
+     * any communication with the parent process. Let's also do this before
+     * child_init() hooks are called and possibly create threads that
+     * otherwise could "steal" (implicitely) MPM's signals.
      */
     rv = apr_setup_signal_thread();
     if (rv != APR_SUCCESS) {
@@ -1131,6 +1130,8 @@ static void child_main(int child_num_arg, int child_bucket)
         clean_child_exit(APEXIT_CHILDFATAL);
     }
 
+    ap_run_child_init(pchild, ap_server_conf);
+
     if (ap_max_requests_per_child) {
         requests_this_child = ap_max_requests_per_child;
     }