|
|
008793 |
From 20656c3b77cc548b59fea3bde5e2b7705d71c427 Mon Sep 17 00:00:00 2001
|
|
|
008793 |
From: =?UTF-8?q?Jan=20Kalu=C5=BEa?= <jkaluza@apache.org>
|
|
|
008793 |
Date: Mon, 18 Aug 2014 07:43:43 +0000
|
|
|
008793 |
Subject: [PATCH] prefork: Ignore SIGINT in child. This fixes race-condition in
|
|
|
008793 |
signals handling when httpd is runnning on foreground and user hits ctrl+c.
|
|
|
008793 |
In this case, SIGINT is sent to all children followed by SIGTERM from the
|
|
|
008793 |
main process, which interrupts the SIGINT handler and leads to inconsistency
|
|
|
008793 |
(process freezes or crashes).
|
|
|
008793 |
|
|
|
008793 |
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1618555 13f79535-47bb-0310-9956-ffa450edef68
|
|
|
008793 |
---
|
|
|
008793 |
server/mpm/prefork/prefork.c | 10 ++++++++++
|
|
|
008793 |
1 file changed, 10 insertions(+)
|
|
|
008793 |
|
|
|
008793 |
diff --git a/server/mpm/prefork/prefork.c b/server/mpm/prefork/prefork.c
|
|
|
008793 |
index 8790ec0..d6c038b 100644
|
|
|
008793 |
--- a/server/mpm/prefork/prefork.c
|
|
|
008793 |
+++ b/server/mpm/prefork/prefork.c
|
|
|
008793 |
@@ -222,6 +222,9 @@ static void clean_child_exit(int code)
|
|
|
008793 |
{
|
|
|
008793 |
mpm_state = AP_MPMQ_STOPPING;
|
|
|
008793 |
|
|
|
008793 |
+ apr_signal(SIGHUP, SIG_IGN);
|
|
|
008793 |
+ apr_signal(SIGTERM, SIG_IGN);
|
|
|
008793 |
+
|
|
|
008793 |
if (pchild) {
|
|
|
008793 |
apr_pool_destroy(pchild);
|
|
|
008793 |
}
|
|
|
008793 |
@@ -817,6 +820,13 @@ static int make_child(server_rec *s, int slot)
|
|
|
008793 |
*/
|
|
|
008793 |
apr_signal(SIGHUP, just_die);
|
|
|
008793 |
apr_signal(SIGTERM, just_die);
|
|
|
008793 |
+ /* Ignore SIGINT in child. This fixes race-condition in signals
|
|
|
008793 |
+ * handling when httpd is runnning on foreground and user hits ctrl+c.
|
|
|
008793 |
+ * In this case, SIGINT is sent to all children followed by SIGTERM
|
|
|
008793 |
+ * from the main process, which interrupts the SIGINT handler and
|
|
|
008793 |
+ * leads to inconsistency.
|
|
|
008793 |
+ */
|
|
|
008793 |
+ apr_signal(SIGINT, SIG_IGN);
|
|
|
008793 |
/* The child process just closes listeners on AP_SIG_GRACEFUL.
|
|
|
008793 |
* The pod is used for signalling the graceful restart.
|
|
|
008793 |
*/
|
|
|
008793 |
--
|
|
|
008793 |
2.0.4
|
|
|
008793 |
|