httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dean Gaudet <dgau...@hotwired.com>
Subject keepalive resource leak in mod_cgi
Date Tue, 24 Dec 1996 05:39:29 GMT
(Hmm, looks like something caused my last attempt to post this to send it
to Brian for approval.  And since he's away... I'm resending from an
address that should work.)

It looks like mod_cgi uses r->connection->pool in the spawn_child() call.
This has the potential of being a resource leak during keepalive sessions.
Patch included, lightly tested.  Of course I'm not in a position to test
it with CGIs that actually allow keepalives... I'm trying to solve a
different problem at the moment.

Dean

*** mod_cgi.c.dist	Mon Dec 23 20:37:47 1996
--- mod_cgi.c	Mon Dec 23 20:39:54 1996
***************
*** 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))) {
--- 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))) {
***************
*** 450,456 ****
  	kill_timeout (r);
      }
      
!     pfclose (r->connection->pool, script_out);
      
      /* Handle script return... */
      if (script_in && !nph) {
--- 450,456 ----
  	kill_timeout (r);
      }
      
!     pfclose (r->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->connection->pool, script_in);
! 	pfclose (r->connection->pool, script_err);
      }
  
      if (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) {



Mime
View raw message