httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <trawi...@bellsouth.net>
Subject Re: mod_cgid - too many open files
Date Thu, 29 Mar 2001 03:32:12 GMT
"Bill Stoddard" <bill@wstoddard.com> writes:

> Yep, the parent side pipes never being closed. Easy enough to close them thusly:
> apr_close(newproc->in);
> apr_close(newproc->out);
> apr_close(newproc->err);

I don't think they need to be created in the first place...  for now
the cleanups are taking care of them... I suspect that some APR tweaks
are needed to avoid the pipe creation.

> This is not the best solution though. Could probably make it more efficient by ditching
> the APR calls and doing something like this...
> 
> cgid_process
> while(1)
>      sd2 = accept()
>      apr_create_pool()
>      read(sd2,*) to setup env, blah, blah, blah from main server
>      pid = fork()
>      if (pid == 0) {
>        /* in the child */
>        dup2(sd2, STDIN);
>        dup2(sd2, STDOUT)
>         dup2(sd2, STDERR);
>         close(sd2);
>          exec()
>          exit -1
>      } else {
>      /* parent */
>          close(sd2);
>      }

dunno...  Ryan's comment when he committed the changes was that it
helped fit in suexec support...  (it is my understanding that suexec
still doesn't work with mod_cgid)

>     apr_destroy_pool() /* this is also missing in cgid */

a few hours ago I mistakenly put a call to apr_pool_clear() here... I
just revamped the transaction pool a bit to match the MPMs, which is
faster than doing apr_destroy_pool()

> the cgid server needs to be a slim and clean as possible. If it leaks resources under
> stress (or when the machine hits transient resource limits) then the cgid process will
> eventually croak taking down CGIs entirely.  There are three main problems with cgid
> server now: leakes the parent side pipe handles, doesnt clean up the pool, and doesn;t
> have logic to cleanup properly if any of the steps leading up to the apr_create_proc
call
> fails.

the first two issues are fixed in CVS

for the third issue, resources are cleaned up I suspect but I'm not
sure what happens with the apache worker thread/child process waiting
for CGI output... I guess it will report an error after a timeout?  if
so, then that should be sufficient as we're low on resources anyway
and a flurry of activity won't help

-- 
Jeff Trawick | trawickj@bellsouth.net | PGP public key at web site:
       http://www.geocities.com/SiliconValley/Park/9289/
             Born in Roswell... married an alien...

Mime
View raw message