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 2021/04/18 07:14:16 UTC

[Bug 65248] New: Enhancement: Call apache binary within apachectl with "exec" e.g. to ensure PID 1 in Docker

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

            Bug ID: 65248
           Summary: Enhancement: Call apache binary within apachectl with
                    "exec" e.g. to ensure PID 1 in Docker
           Product: Apache httpd-2
           Version: 2.4.3
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Core
          Assignee: bugs@httpd.apache.org
          Reporter: martin.koehler@desy.de
  Target Milestone: ---

Dear All,
For setting up a webserver in a small docker container it is good practice to
run the server in the foreground via "exec"
See E.g. the "official" Apache Docker image:
https://github.com/docker-library/httpd/blob/master/2.4/httpd-foreground
This ensures that the apache binary gets PID 1 and signals are propagated (and
I
think zombies are reaped).


However sometimes it would be nice to use the apachectl script within docker,
since
it loads environment variables, ... and is handy if one uses e.g. a debian
image.

Currently this does not work, since inside apachectl the actual apache programm
is
called without "exec". 
See e.g. lines starting wit $HTTPD in /usr/sbin/apachectl
...
restart|graceful)
    if $HTTPD ${APACHE_ARGUMENTS} -t 2> /dev/null ; then
        $HTTPD ${APACHE_ARGUMENTS} -k "$ARGV"
    else
        $HTTPD ${APACHE_ARGUMENTS} -t
    fi
    ERROR=$?
    ;;
...



The result is that the apachectl script remains with PID
1 and e.g. signals (like USR1) for the container get not propagated correctly
to
the apache process.
If one patches the apachectl so that all calls to the apache binary are done
with "exec", everthing works as expected.
(e.g. for debian execute 
`sed -i 's/\($HTTPD ${APACHE_ARGUMENTS}\)/exec \1/' /usr/sbin/apache2ctl` as
root)

Might it be a sensible change in the apachectl to always call the binary with
"exec" (at least on the systems where exec exists)
Thanks

-- 
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