httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Handler <>
Subject Re: Running Apache in the foreground
Date Wed, 02 Jan 2002 22:57:16 GMT
[ resending because i sent from the wrong From: header last time.
  here's to hoping that this doesn't show up twice. apologies in
  advance if it does... ] 

I'd also like to voice my support for implementing Jos' requested
functionality. NO_DETACH may have originally been intended just for
debugging purposes, but many sites are moving to universal process
managers like djb's daemontools, and it would be extremely useful
to all of us if Apache's httpd provided the necessary knob to run
under svscan & supervise out of the box.

(A Google search for "apache daemontools patch" reveals patches for
this functionality dating back to at least 1.3.12, which should
give you an idea of how long people have been re-implementing this
for each version. :))

Jos Backus wrote:

> In order for httpd to support this mode of operation it should not fork (and
> decouple itself from its parent) but still run in its own process group, so
> that this pgrp only contains it and its children. A workaround would be to use
> the pgrphack program that comes with daemontools, which looks like this:

Aaron Bannert responded:

> Hmm.. You'll have to ensure by other means that httpd is not a process
> group leader, most likely by ensuring that httpd is started by another
> process and not interactively by the shell.

Correct. The don't-fork-but-still-setsid mode is a specialized
method meant for process controllers only, and it should be
administrator brain damage to try and utilize it from an interactive
shell -- much like invoking a daemon with verbose debug arguments
and then complaining about the output. :) I think putting a note
in the documentation to this effect should be sufficient. Also note
that invoking this mode from shells without job control (Solaris
/bin/sh) works fine, as they don't try and create unique process
groups for each invoked job, AFAICT.

I submitted a patch regarding this issue for 1.3.22 earlier today,
in which I also noted 2.0's issue with setsid(2) regarding this.
(Sorry for the bad line-wrap in the PR.)

Thanks for your consideration!


-- (michael handler)                           washington, dc

View raw message