httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Kraemer <>
Subject [BUG] ENETDOWN - apache loops
Date Tue, 20 Jul 1999 14:17:50 GMT
I am currently working on a patch to gracefully handle the situation
where apache loops indefinitely after the network layer has been stopped
("/etc/rc?.d/K??tcp stop" or some such).

In such a situation, the children get a return code of -1 in accept()
with errno set to ENETDOWN.

Currently, they exit(1) because the accept() failed, and the parent
tries to create them again, which leads to an endless
accept() fail - exit(1) - fork() loop which quickly fills up your
error_log file. I would like apache to recover from this loop by

a) [easy solution]
    have the children detect ENETDOWN and terminate with a
    This will tell the parent to shut down as well, after logging the
    fact that the child signaled it to do so.

b) [more complicated solution]
    Have the children signal an exceptional situation to the parent by
    exiting with a yet-to-be-determined exit code. Upon receiving this
    exit code, the parent would enter a "almost-graceful-restart"-state
    with the exception that it would periodically monitor the state of the
    main listening socket (e.g., by periodically doing a select() with
    timeout) until the system has recovered from the ENETDOWN situation.
    The advantage of this would be that on long-running server machines,
    apache would recover from a short-term reconfiguration of the
    network interface.

While I'm writing this, I severely wonder if the whole "loop-while-
ENETDOWN" stuff isn't totally bogus. I'd think that the administrator
should just know that server processes will die when {s}he shuts down
the network. Therefore, I'd favor solution a) over b).

What do you think?

<Martin.Kraemer@MchP.Siemens.De>      |        Siemens Information and
Phone: +49-89-636-46021               |        Communication  Products
FAX:   +49-89-636-47816               |        81730  Munich,  Germany

View raw message