From 0e1423f24707251d1df9f90ce2f72de0d7f5999e Mon Sep 17 00:00:00 2001 From: Yann Ylavic Date: Fri, 21 Oct 2016 21:44:29 +0000 Subject: [PATCH] mpm_unix: Apache fails to start if previously crashed then restarted with the same PID (e.g. in container). PR 60261. Proposed by: Val Reviewed by: ylavic git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1766160 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 4 ++++ server/mpm_unix.c | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 4630dc2839..31b0fac848 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,10 @@ -*- coding: utf-8 -*- Changes with Apache 2.5.0 + *) mpm_unix: Apache fails to start if previously crashed then restarted with + the same PID (e.g. in container). PR 60261. + [Val , Yann Ylavic] + *) mod_dav: Fix a potential cause of unbounded memory usage or incorrect behavior in a routine that sends 's to the output filters. [Evgeny Kotkov] diff --git a/server/mpm_unix.c b/server/mpm_unix.c index 06318fe4a2..140d4e8f68 100644 --- a/server/mpm_unix.c +++ b/server/mpm_unix.c @@ -788,7 +788,10 @@ int ap_signal_server(int *exit_status, apr_pool_t *pconf) status = "httpd (no pid file) not running"; } else { - if (kill(otherpid, 0) == 0) { + /* With containerization, httpd may get the same PID at each startup, + * handle it as if it were not running (it obviously can't). + */ + if (otherpid != getpid() && kill(otherpid, 0) == 0) { running = 1; status = apr_psprintf(pconf, "httpd (pid %" APR_PID_T_FMT ") already " -- 2.40.0