Return-Path: Delivered-To: apmail-httpd-modules-dev-archive@locus.apache.org Received: (qmail 12071 invoked from network); 15 Oct 2007 17:59:29 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 15 Oct 2007 17:59:29 -0000 Received: (qmail 28022 invoked by uid 500); 15 Oct 2007 17:58:47 -0000 Delivered-To: apmail-httpd-modules-dev-archive@httpd.apache.org Received: (qmail 27999 invoked by uid 500); 15 Oct 2007 17:58:47 -0000 Mailing-List: contact modules-dev-help@httpd.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: modules-dev@httpd.apache.org Delivered-To: mailing list modules-dev@httpd.apache.org Received: (qmail 27990 invoked by uid 99); 15 Oct 2007 17:58:47 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 15 Oct 2007 10:58:47 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [166.70.186.42] (HELO onyx.sharktooth.org) (166.70.186.42) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 15 Oct 2007 17:58:48 +0000 Received: from corvette.dnsdhcp.provo.novell.com ([137.65.60.38]) by onyx.sharktooth.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.63 (FreeBSD)) (envelope-from ) id 1IhU9g-000J53-E1 for modules-dev@httpd.apache.org; Mon, 15 Oct 2007 11:55:06 -0600 Message-ID: <4713ABB3.9020606@joe-lewis.com> Date: Mon, 15 Oct 2007 12:04:35 -0600 From: Joe Lewis User-Agent: Thunderbird 1.5.0.8 (X11/20060911) MIME-Version: 1.0 To: modules-dev@httpd.apache.org References: <393371.33560.qm@web60314.mail.yahoo.com> In-Reply-To: <393371.33560.qm@web60314.mail.yahoo.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 137.65.60.38 X-SA-Exim-Mail-From: joe@joe-lewis.com X-Spam-Checker-Version: SpamAssassin 3.1.7 (2006-10-05) on onyx.sharktooth.org X-Spam-Level: Subject: Re: [Unload module] X-SA-Exim-Version: 4.2 X-SA-Exim-Scanned: Yes (on onyx.sharktooth.org) X-Virus-Checked: Checked by ClamAV on apache.org X-Old-Spam-Status: No, score=-1.4 required=5.0 tests=ALL_TRUSTED autolearn=failed version=3.1.7 Marin Cosmin wrote: > Hello, > > I'm working on an Apache module that will log some statistics in a file. > My problem is that I have no ideea about what should I do to unload the module. > In ap_hook_post_config hook I initialize some structures, use open() for some files ... > If I get an error during this phase how can I unload the module ? > > I'm not sure that unloading the module is a good idea. I'd suggest using one of the *open_logs or *post_config hooks - and return an appropriate error code if failure occurs. If you find that apache continues to load, then you may want to set a flag in a configuration structure that you can use to determine if you had success earlier. (For example, so that you don't try to write statistics to a file that failed to open earlier). > Where should I destroy IPCS ? > I used apr_pool_cleanup_register here but the behaviuor isn't the desired one. > > Using apr_pool_cleanup_register in ap_hook_child_init seems to work. > That is where you want it - when the child starts, each child needs to be able to clean up after itself, hence wait until the child starts to register that one. This is a bit more clear when comparing worker vs. prefork MPM's - each child process has to take care of it's own in order to prevent memory leaks, etc. Joe -- Joseph Lewis "Divide the fire, and you will sooner put it out." - Publius Syrus