From 9f6769f207216543fa49bf51a50ea8dbdeffc621 Mon Sep 17 00:00:00 2001 From: Jim Jagielski Date: Fri, 4 Nov 2016 19:02:44 +0000 Subject: [PATCH] Merge r1766160 from trunk: 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 Submitted by: ylavic Reviewed/backported by: jim git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1768078 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 4 ++++ STATUS | 6 ------ server/mpm_unix.c | 5 ++++- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/CHANGES b/CHANGES index 0d6561b6629..af16fcc6540 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,10 @@ Changes with Apache 2.4.24 + *) 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_http2: unannounced and multiple interim responses (status code < 200) are parsed and forwarded to client until a final response arrives. [Stefan Eissing] diff --git a/STATUS b/STATUS index 9e9490abbba..1ab3c778329 100644 --- a/STATUS +++ b/STATUS @@ -117,12 +117,6 @@ RELEASE SHOWSTOPPERS: PATCHES ACCEPTED TO BACKPORT FROM TRUNK: [ start all new proposals below, under PATCHES PROPOSED. ] - *) mpm_unix: Apache fails to start if previously crashed then restarted with - the same PID (e.g. in container). PR 60261. - trunk patch: http://svn.apache.org/r1766160 - 2.4.x patch: trunk works (modulo CHANGES) - +1: ylavic, jim, covener - *) http: Respond with "408 Request Timeout" when a timeout occurs while reading the request body. PR 60313. trunk patch: http://svn.apache.org/r1739201 diff --git a/server/mpm_unix.c b/server/mpm_unix.c index 1a7f9359c73..7a118546698 100644 --- a/server/mpm_unix.c +++ b/server/mpm_unix.c @@ -787,7 +787,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.47.2