httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dean Gaudet <dgau...@arctic.org>
Subject CGI 3 second problem
Date Wed, 19 Mar 1997 18:45:54 GMT
This 3 second delay problem, have we ever been able to reproduce it?  Is
it only on SSI included CGIs? 

BTW, there was one change between 1.1 and 1.2 betas that would affect
this.  That is the change from allocating CGIs from r->connection->pool
(in 1.1)  to r->pool (in 1.2 betas).  The connection pool isn't cleaned up
until after the request is done, but r->pool is cleaned up as soon as the
subrequest is done running, which is before handle_include and include_cgi
return. 

Unfortunately that change is required to support long running persistent
connections, otherwise we have zombies lying around. 

One way of fixing this is to keep track of all the proc chains as global
state in each process.  Then we could have a quick non-blocking zombie
check in the child_main loop which would remove the zombies from any of
the proc chains as appropriate.  Then we could allocate CGIs out of the
connection pool rather than the request pool, which delays their cleanup. 

In this case free_proc_chain essentially becomes a non-blocking zombie
check followed by kills down the proc_chain to be freed.  Followed by a
zombie check that blocks and times out after 3 seconds.  Followed by kill
-9s down the proc chain, followed by another non-blocking zombie check. 

Yep it's another asynchronous cleanup solution... 

I'm too busy this week to do this.  But if someone can get the patch below
to the people who have reported this we can at least find out if the
r->pool thing is the cause of the problem. 

Dean

Index: mod_cgi.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_cgi.c,v
retrieving revision 1.26
retrieving revision 1.25
diff -c -3 -r1.26 -r1.25
*** mod_cgi.c	1996/12/24 20:03:23	1.26
--- mod_cgi.c	1996/12/17 22:13:06	1.25
***************
*** 389,395 ****
      cld.debug = conf->logname ? 1 : 0;
      
      if (!(child_pid =
! 	  spawn_child_err (r->pool, cgi_child, (void *)&cld,
  			   nph ? just_wait : kill_after_timeout,
  #ifdef __EMX__
  			   &script_out, &script_in, &script_err))) {
--- 389,395 ----
      cld.debug = conf->logname ? 1 : 0;
      
      if (!(child_pid =
! 	  spawn_child_err (r->connection->pool, cgi_child, (void *)&cld,
  			   nph ? just_wait : kill_after_timeout,
  #ifdef __EMX__
  			   &script_out, &script_in, &script_err))) {
***************
*** 450,456 ****
  	kill_timeout (r);
      }
      
!     pfclose (r->pool, script_out);
      
      /* Handle script return... */
      if (script_in && !nph) {
--- 450,456 ----
  	kill_timeout (r);
      }
      
!     pfclose (r->connection->pool, script_out);
      
      /* Handle script return... */
      if (script_in && !nph) {
***************
*** 496,503 ****
  	while (fgets(argsbuffer, HUGE_STRING_LEN-1, script_err) != NULL)
  	  continue;
  	kill_timeout (r);
! 	pfclose (r->pool, script_in);
! 	pfclose (r->pool, script_err);
      }
  
      if (nph) {
--- 496,503 ----
  	while (fgets(argsbuffer, HUGE_STRING_LEN-1, script_err) != NULL)
  	  continue;
  	kill_timeout (r);
! 	pfclose (r->connection->pool, script_in);
! 	pfclose (r->connection->pool, script_err);
      }
  
      if (nph) {


Mime
View raw message