summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
authorJim Jagielski <jim@apache.org>2017-08-16 16:49:12 +0000
committerJim Jagielski <jim@apache.org>2017-08-16 16:49:12 +0000
commit02b33c41ad5f07fc5bffa40415b5ccb2cd5e7d8a (patch)
tree359b4e676fcc87cbd065d225c40be858c42ed0fc /server
parentd64568ba342541da74f988811774a41a5e7cdb10 (diff)
downloadhttpd-02b33c41ad5f07fc5bffa40415b5ccb2cd5e7d8a.tar.gz
Merge r1618555 from trunk:
prefork: Ignore SIGINT in child. This fixes race-condition in signals handling when httpd is runnning on foreground and user hits ctrl+c. In this case, SIGINT is sent to all children followed by SIGTERM from the main process, which interrupts the SIGINT handler and leads to inconsistency (process freezes or crashes). Submitted by: jkaluza Reviewed by: ylavic, jorton, jim git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1805222 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'server')
-rw-r--r--server/mpm/prefork/prefork.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/server/mpm/prefork/prefork.c b/server/mpm/prefork/prefork.c
index 559f90a95e..a386a757ff 100644
--- a/server/mpm/prefork/prefork.c
+++ b/server/mpm/prefork/prefork.c
@@ -220,6 +220,9 @@ static void clean_child_exit(int code)
{
retained->mpm->mpm_state = AP_MPMQ_STOPPING;
+ apr_signal(SIGHUP, SIG_IGN);
+ apr_signal(SIGTERM, SIG_IGN);
+
if (pchild) {
apr_pool_destroy(pchild);
}
@@ -699,6 +702,13 @@ static int make_child(server_rec *s, int slot, int bucket)
*/
apr_signal(SIGHUP, just_die);
apr_signal(SIGTERM, just_die);
+ /* Ignore SIGINT in child. This fixes race-condition in signals
+ * handling when httpd is runnning on foreground and user hits ctrl+c.
+ * In this case, SIGINT is sent to all children followed by SIGTERM
+ * from the main process, which interrupts the SIGINT handler and
+ * leads to inconsistency.
+ */
+ apr_signal(SIGINT, SIG_IGN);
/* The child process just closes listeners on AP_SIG_GRACEFUL.
* The pod is used for signalling the graceful restart.
*/