Return-Path: Delivered-To: new-httpd-archive@hyperreal.org Received: (qmail 15587 invoked by uid 6000); 27 Nov 1997 19:06:48 -0000 Received: (qmail 15580 invoked from network); 27 Nov 1997 19:06:46 -0000 Received: from twinlark.arctic.org (204.62.130.91) by taz.hyperreal.org with SMTP; 27 Nov 1997 19:06:46 -0000 Received: (qmail 21323 invoked by uid 500); 27 Nov 1997 19:10:43 -0000 Date: Thu, 27 Nov 1997 11:10:42 -0800 (PST) From: Dean Gaudet To: new-httpd@apache.org Subject: Re: fundamentally wrong forking prior to garbage collection in proxy/ In-Reply-To: Message-ID: Legal: "Copyright (c) 1997 Dean Gaudet, all rights reserved. Visit http://www.arctic.org/~dgaudet/legal for more information." Organization: Transmeta Corp. MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: new-httpd-owner@apache.org Precedence: bulk Reply-To: new-httpd@apache.org I haven't looked to see... but you should fork() twice to disassociate yourself from the child, and the child should wait for the first fork()ed process to return before continuing (otherwise there'll be a zombie). The whole thing should be inside a block_alarms() and unblock_alarms() section. And it's probably not something we can do under win32... You may even want to setpgrp() after the second fork so that the httpd parent can't send you SIGHUP/USR1/TERM. Dean On Wed, 26 Nov 1997, Dirk-Willem van Gulik wrote: > > Forking off the garbage collecting child in the proxy. > > Anything fundamentally wrong with this quick and dirty hack, it > does seem to work and my my employer happy. But it seems to > crude to me. > > Dw. > > diff -c3 -r apache_1.2.4/src/modules/proxy/proxy_cache.c > apache_1.2.4-work/src/modules/proxy/proxy_cache.c > *** apache_1.2.4/src/modules/proxy/proxy_cache.c Fri Aug 15 > 19:08:55 1997 > --- apache_1.2.4-work/src/modules/proxy/proxy_cache.c Wed Nov 26 > 16:48:07 1997 > *************** > *** 88,94 **** > static int sub_garbage_coll(request_rec *r,array_header *files, > const char *cachedir,const char *cachesubdir); > > ! void proxy_garbage_coll(request_rec *r) > { > const char *cachedir; > void *sconf = r->server->module_config; > --- 88,112 ---- > static int sub_garbage_coll(request_rec *r,array_header *files, > const char *cachedir,const char *cachesubdir); > > ! void _proxy_garbage_coll(request_rec *r); > ! > ! void proxy_garbage_coll(request_rec *r) { > ! > ! pid_t chld = fork(); > ! > ! /* parent return.. */ > ! if ( chld > 0 ) > ! return; > ! > ! _proxy_garbage_coll(r); > ! > ! if (chld == 0) /* only true children exit */ > ! exit(0); > ! > ! return; /* but return if we did not fork OK */ > ! > ! } > ! > ! void _proxy_garbage_coll(request_rec *r) > { > const char *cachedir; > void *sconf = r->server->module_config; > *************** > *** 101,106 **** > --- 119,129 ---- > int i, timefd; > static time_t lastcheck=BAD_DATE; /* static data!!! */ > > + pid_t chld = fork(); > + > + if (chld > 0) > + return; > + > cachedir = conf->root; > cachesize = conf->space; > every = conf->gcinterval; > > > http://cils.ceo.org http://enrm.ceo.org > dirkx@technologist.com Dirk.vanGulik@jrc.it > +39 332 78 0014 +39 332 78 9549 fax +39 332 78 9185 > ISEI/ESBA; The Center For Earth Observation > Joint Research Centre of the European Communities, Ispra, Italy > >