httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Sutton <>
Subject Graceful restarts and Listen's
Date Thu, 08 Aug 1996 07:23:08 GMT
Does the graceful restart stuff work with Listens? As far as I can
see it doesn't, but I can't beleive no-one's noticed this so I
must be doing something wrong.

Anyway, I think the problem is that there is now an fd element in the
listener structure. When created, this has value 0 (in set_listener).
When standalone_main() comes to listen, it only makes a socket
for listeners with fd's of < 0.

A fix which seems to work is assigning new->fd = -1 in set_listener (patch

On a related note, is there a way we can force old children to die after a
graceful restart? It seems when you -USR1 your server, it creates
StartServers number of new children, but the old ones stay around until
they have completed their current transaction. Fine. But if there are not
currently in a transaction (perhaps waiting for the mutex lock, or doing a
select()), they will wait a potentially long time. At least on the systems
I've tried, it appears that the _new_ children seem to get the majority of
the incoming connections. Since the parent will create new children as the
load increases, it could be a long time before all the old children have
accepted a connection and died.

I don't know if this is a real problem: do the old children die reasonably
quickly on real-world systems? Or is having a bunch of old-fashioned
children around for a time not such a big deal? If it is a problem, we
_could_ get the select code to timeout and do a generation check at
regular intervals.  For the select this is easy -- just add a timeval
argument, and put it in a loop

  do {
    csd=select(...., &tv);
    if (csd==0 && scoreboard_gen >= our_gen) die;
  while (csd == 0);

sort of thing. But most OS's have the mutex stuff outside this, which is
more difficult because it doesn't timeout. So perhaps it's not worth
bothering about.

UK Web

*** http_core.c Wed Aug  7 15:44:11 1996
---     Thu Aug  8 09:22:13 1996
*** 998,1003 ****
--- 998,1004 ----
        new->local_addr.sin_addr.s_addr = get_virthost_addr(ips, NULL);
      new->local_addr.sin_port = htons(atoi(ports));
+     new->fd = -1;
      new->next = listeners;
      listeners = new;
      return NULL;

View raw message