Return-Path: Delivered-To: apmail-perl-dev-archive@www.apache.org Received: (qmail 78343 invoked from network); 1 Dec 2004 01:31:38 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 1 Dec 2004 01:31:38 -0000 Received: (qmail 77928 invoked by uid 500); 1 Dec 2004 01:31:33 -0000 Delivered-To: apmail-perl-dev-archive@perl.apache.org Received: (qmail 77889 invoked by uid 500); 1 Dec 2004 01:31:33 -0000 Mailing-List: contact dev-help@perl.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Delivered-To: mailing list dev@perl.apache.org Received: (qmail 77836 invoked by uid 99); 1 Dec 2004 01:31:32 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from mail.logilune.com (HELO mail.logilune.com) (195.80.154.36) by apache.org (qpsmtpd/0.28) with ESMTP; Tue, 30 Nov 2004 17:31:30 -0800 Received: from [127.0.0.1] (localhost.logilune.com [127.0.0.1]) by mail.logilune.com (Postfix) with ESMTP id 2ABC71E1DA9; Wed, 1 Dec 2004 02:31:27 +0100 (CET) Message-ID: <41AD1EED.50800@stason.org> Date: Tue, 30 Nov 2004 20:31:25 -0500 From: Stas Bekman Organization: Hope, Humanized User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20040913 X-Accept-Language: en-us, en, he, ru MIME-Version: 1.0 To: Geoffrey Young Cc: mod_perl Dev Subject: Re: per-server cleanups core dump? geoff? References: <41A6051B.7080602@stason.org> <41AB5463.8080600@modperlcookbook.org> <41ABB733.1010207@stason.org> <41AC9932.2030202@modperlcookbook.org> In-Reply-To: <41AC9932.2030202@modperlcookbook.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Geoffrey Young wrote: >>So may be your orig patch from: >>http://thread.gmane.org/gmane.comp.apache.mod-perl.devel/730 >>is the way to go, > > > well, if you mean the patch that started the thread, I seem to say there > that the patch keeps things from segfaulting, but that the callback isn't > actually run. in other words, the patch didn't really work, but was > probably meant to be a starting point to something better. Actually your patch, Geoff, was perfectly fine. It wasn't supposed to work for cleanups registered from the child processes, because child processes don't run cleanup handlers, because server_pool is cleaned internally w/o letting the parent pool destroy it (child_exit is a special case). But it works perfectly fine for parent process cleanup, but you need to register that in the parent process (i.e. at the server startup). See the modperl_extra.pl addition in the patch below. it logs the date twice on server start, i.e. every time server_pool is recreated. So let me know where are we on this story. Index: xs/maps/modperl_functions.map =================================================================== --- xs/maps/modperl_functions.map (revision 109257) +++ xs/maps/modperl_functions.map (working copy) @@ -78,6 +78,7 @@ MODULE=Apache::ServerUtil PACKAGE=Apache::ServerRec SV *:DEFINE_dir_config | | server_rec *:s, char *:key=NULL, SV *:sv_val=Nullsv + apr_pool_t:DEFINE_pool MODULE=Apache::ServerUtil PACKAGE=Apache::ServerUtil mpxs_Apache__ServerUtil_server_root_relative | | p, fname="" Index: xs/Apache/ServerUtil/Apache__ServerUtil.h =================================================================== --- xs/Apache/ServerUtil/Apache__ServerUtil.h (revision 109257) +++ xs/Apache/ServerUtil/Apache__ServerUtil.h (working copy) @@ -13,6 +13,8 @@ * limitations under the License. */ +#define mpxs_Apache__ServerRec_pool modperl_server_pool + #define mpxs_Apache__ServerRec_method_register(s, methname) \ ap_method_register(s->process->pconf, methname); Index: t/conf/modperl_extra.pl =================================================================== --- t/conf/modperl_extra.pl (revision 109257) +++ t/conf/modperl_extra.pl (working copy) @@ -49,8 +49,14 @@ test_perl_ithreads(); +my $server_pool = Apache::ServerRec::pool(); +$server_pool->cleanup_register( + sub { + local %ENV; + qx[/bin/date >> /tmp/date]; + Apache::OK; + }); - ### only subs below this line ### sub reorg_INC { Index: t/response/TestAPI/server_util.pm =================================================================== --- t/response/TestAPI/server_util.pm (revision 109257) +++ t/response/TestAPI/server_util.pm (working copy) @@ -29,7 +29,7 @@ sub handler { my $r = shift; - plan $r, tests => 15; + plan $r, tests => 17; { my $s = $r->server; @@ -48,6 +48,14 @@ server_root_relative_tests($r); + my $server_pool = Apache::ServerRec::pool(); + ok $server_pool->isa('APR::Pool'); + + # this will never run since it's not registered in the parent + # process + $server_pool->cleanup_register(sub { Apache::OK }); + ok 1; + Apache::OK; } -- __________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:stas@stason.org http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org For additional commands, e-mail: dev-help@perl.apache.org