You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2016/10/17 07:38:13 UTC

[Bug 60261] New: Apache fails to start if previously crashed then restarted with same PID

https://bz.apache.org/bugzilla/show_bug.cgi?id=60261

            Bug ID: 60261
           Summary: Apache fails to start if previously crashed then
                    restarted with same PID
           Product: Apache httpd-2
           Version: 2.4.23
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core
          Assignee: bugs@httpd.apache.org
          Reporter: valentin.bremond@gmail.com

Created attachment 34377
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=34377&action=edit
Proposed patch

Overview:

This problem occurs mainly with Docker (or other containerization technologies)
with the main process being Apache because it always have the same PID (PID 1). 

The issue arises when the container (or the process inside) fails without
proper error handling (kill -9 for example). In this case, Apache can't remove
its PID file (which contains "1").
Once the container is restarted, Apache restarts inside with PID 1 but fails
when reading the PID file which also contains "1" (with error: "http (pid 1)
already running").


Steps to Reproduce:

* docker run -it httpd:latest bash
* get current PID counter: `ps -ef`, then get "ps" current PID (let's assume
it's 5)
* set this PID + 1 to logs/httpd.pid: `echo 6 > logs/httpd.pid`
* try to run Apache: it fails with: httpd (pid 6) already running


Actual Results:

Apache fails to start although there is no reason to fail.


Expected Results:

Apache can realize the PID in the file is actually himself and can then proceed
to launch.


Build Date & Hardware:

2016-10-14 on Linux (CentOS 7.2.1511, Docker 1.12.0, Apache from 2.4.6 to
2.4.23)

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 60261] Apache fails to start if previously crashed then restarted with same PID

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60261

Yann Ylavic <yl...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |FixedInTrunk

--- Comment #3 from Yann Ylavic <yl...@gmail.com> ---
Committed in r1766160 and proposed for backport to 2.4.x.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 60261] Apache fails to start if previously crashed then restarted with same PID

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60261

--- Comment #2 from Val <va...@gmail.com> ---
Hello,

Yep it works too. Your patch is indeed simpler but still understandable.

OK for me!

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 60261] Apache fails to start if previously crashed then restarted with same PID

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60261

Yann Ylavic <yl...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #4 from Yann Ylavic <yl...@gmail.com> ---
Backported to upcoming 2.4.24 in r1768078.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org


[Bug 60261] Apache fails to start if previously crashed then restarted with same PID

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60261

--- Comment #1 from Yann Ylavic <yl...@gmail.com> ---
Created attachment 34378
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=34378&action=edit
Same PID can't be running

Thanks for the report (and patch).

This other approach handles the case as if httpd were not running (it can't
be), no particular logging (possibly obscure, especially if some stop is
asked).

There is still later message about "pid file %s overwritten -- Unclean shutdown
of previous Apache run?", which I think is enough as notice for (re)starts.

Does it work for you?

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org