httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben Laurie <...@gonzo.ben.algroup.co.uk>
Subject Scoreboard race condition fix
Date Fri, 08 Dec 1995 19:18:09 GMT
OK, here's the patch to cure (I hope) the problem. Note, as I mentioned before
that backing out patch 20 only reduces the likelihood of the bug. Note that in
this patch I have eliminated the reopen_scoreboard call - it is unnecessary,
and in fact leads to the problem, often bemoaned, that cron deleting the
scoreboard screws up everything. In fact, we should delete it ourselves, to
prevent interference, but I imagine people use it for status monitoring?

Cheers,

Ben.

------- SNIP HERE ---------
From: ben@algroup.co.uk (Ben Laurie)
Subject: Cure scoreboard race condition
Affects: http_main.c scoreboard.h
Changelog: On very heavily loaded servers, the scoreboard could lag behind
	reality, thus causing a nasty race condition which spawned many extra
	servers. This patch cures that problem, and incidentally removes the
	problem with the scoreboard being deleted.

*** http_main.c.old	Fri Dec  8 18:59:11 1995
--- http_main.c	Fri Dec  8 19:04:48 1995
***************
*** 381,386 ****
--- 381,387 ----
  		 sizeof(scoreboard_image));
  }
  
+ #if 0
  void reopen_scoreboard (pool *p)
  {
      if (scoreboard_fd != -1) pclosef (p, scoreboard_fd);
***************
*** 393,398 ****
--- 394,400 ----
  	exit (1);
      }
  }
+ #endif
  
  void cleanup_scoreboard ()
  {
***************
*** 433,439 ****
      int res = 0;
  
      for (i = 0; i < HARD_SERVER_MAX; ++i)
! 	if (scoreboard_image[i].status == SERVER_READY)
  	    ++res;
  
      return res;
--- 435,442 ----
      int res = 0;
  
      for (i = 0; i < HARD_SERVER_MAX; ++i)
! 	if (scoreboard_image[i].status == SERVER_READY
! 	  || scoreboard_image[i].status == SERVER_STARTING)
  	    ++res;
  
      return res;
***************
*** 739,745 ****
      dupped_csd = -1;
      child_num = child_num_arg;
      requests_this_child = 0;
!     reopen_scoreboard (pconf);
      update_child_status (child_num, SERVER_READY);
  
      /* Only try to switch if we're running as root */
--- 742,748 ----
      dupped_csd = -1;
      child_num = child_num_arg;
      requests_this_child = 0;
! /*    reopen_scoreboard (pconf);*/
      update_child_status (child_num, SERVER_READY);
  
      /* Only try to switch if we're running as root */
***************
*** 963,969 ****
--- 966,975 ----
  	if ((count_idle_servers() < daemons_min_free)
  	    && (child_slot = find_free_child_num()) >= 0
  	    && child_slot <= daemons_limit)
+ 	    {
+ 	    update_child_status(child_slot,SERVER_STARTING);
  	    make_child(server_conf, child_slot);
+ 	    }
      }
  
  } /* standalone_main */

-- 
Ben Laurie                  Phone: +44 (181) 994 6435
Freelance Consultant        Fax:   +44 (181) 994 6472
and Technical Director      Email: ben@algroup.co.uk
A.L. Digital Ltd,           URL: http://www.algroup.co.uk
London, England.

Mime
View raw message