httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Roy T. Fielding" <field...@kiwi.ICS.UCI.EDU>
Subject [PATCH] make_child and SERVER_STARTING forever
Date Sat, 25 Jan 1997 04:24:48 GMT
I'd like to apply this as well, but I can't until I can commit
the other patch to http_main.c.

.....Roy

Date: Wed, 15 Jan 1997 16:44:55 -0500
From: Phillip Vandry <vandry@staple.mlink.net>
To: apache-bugs@apache.org
Subject: Bug report

We operate a fairly large Apache server (half a million hits per day)
under Solaris 2.5 and we are experiencing hanging problems, where the
server will occasionally block, and connections are accepted, but no
requests are processed for 40 or 50 seconds or more.

I think the following bug is part of the problem, but not all of it.

If a child fails to initialize and craps out, it will be reaped by the
main process and the scoreboard will be updated to SERVER_DEAD. But
if the fork() in make_child() fails, the scoreboard will continue
to say SERVER_STARTING forever. Eventually, the main process will
refuse to start new children because count_idle_servers() will count those
SERVER_STARTING entries and will always report that there are enough
idle servers.

Thanks.
-Phil

*** http_main.c	1997/01/09 15:14:53	1.2
--- http_main.c	1997/01/15 21:30:09
***************
*** 1675,1681 ****
      }
  }

! void make_child(server_rec *server_conf, int child_num)
  {
      int pid;

--- 1675,1681 ----
      }
  }

! int make_child(server_rec *server_conf, int child_num)
  {
      int pid;

***************
*** 1693,1699 ****
             over and over again. */
  	sleep(10);

! 	return;
      }

      if (!pid) {
--- 1693,1699 ----
             over and over again. */
  	sleep(10);

! 	return -1;
      }

      if (!pid) {
***************
*** 1701,1706 ****
--- 1701,1707 ----
  	signal (SIGTERM, (void (*)())just_die);
  	child_main (child_num);
      }
+     return 0;
  }

  static int
***************
*** 1974,1980 ****
  	    Explain1("Starting new child in slot %d",child_slot);
  	    (void)update_child_status(child_slot,SERVER_STARTING,
  	     (request_rec*)NULL);
! 	    make_child(server_conf, child_slot);

  	}

--- 1975,1986 ----
  	    Explain1("Starting new child in slot %d",child_slot);
  	    (void)update_child_status(child_slot,SERVER_STARTING,
  	     (request_rec*)NULL);
! 	    if (make_child(server_conf, child_slot) < 0) {
! 		/* fork didn't succeed. Fix the scoreboard or else
! 		   it will say SERVER_STRATING forever and ever */
! 	        (void)update_child_status(child_slot,SERVER_DEAD,
! 	             (request_rec*)NULL);
! 	    }

  	}

Mime
View raw message