httpd/httpd-2.4.10-sigint.patch

29 lines
1.1 KiB
Diff
Raw Normal View History

diff --git a/server/mpm/prefork/prefork.c b/server/mpm/prefork/prefork.c
2017-06-19 09:48:36 +00:00
index 559f90a..a386a75 100644
--- a/server/mpm/prefork/prefork.c
+++ b/server/mpm/prefork/prefork.c
2017-06-19 09:48:36 +00:00
@@ -220,6 +220,9 @@ static void clean_child_exit(int code)
{
2017-06-19 09:48:36 +00:00
retained->mpm->mpm_state = AP_MPMQ_STOPPING;
+ apr_signal(SIGHUP, SIG_IGN);
+ apr_signal(SIGTERM, SIG_IGN);
+
if (pchild) {
apr_pool_destroy(pchild);
}
2017-06-19 09:48:36 +00:00
@@ -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.
*/