Return-Path: Delivered-To: apmail-httpd-dev-archive@www.apache.org Received: (qmail 87942 invoked from network); 27 Sep 2010 14:28:36 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 27 Sep 2010 14:28:36 -0000 Received: (qmail 91276 invoked by uid 500); 27 Sep 2010 14:28:35 -0000 Delivered-To: apmail-httpd-dev-archive@httpd.apache.org Received: (qmail 90760 invoked by uid 500); 27 Sep 2010 14:28:32 -0000 Mailing-List: contact dev-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list dev@httpd.apache.org Received: (qmail 90743 invoked by uid 99); 27 Sep 2010 14:28:31 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Sep 2010 14:28:31 +0000 X-ASF-Spam-Status: No, hits=-2.3 required=10.0 tests=RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [188.40.99.202] (HELO eru.sfritsch.de) (188.40.99.202) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 27 Sep 2010 14:28:24 +0000 Received: from [10.1.1.6] (helo=k.localnet) by eru.sfritsch.de with esmtp (Exim 4.69) (envelope-from ) id 1P0EgU-0003Z6-QE for dev@httpd.apache.org; Mon, 27 Sep 2010 16:28:02 +0200 From: Stefan Fritsch To: dev@httpd.apache.org Subject: Re: memory leak in mod_slotmem_shm Date: Mon, 27 Sep 2010 16:28:01 +0200 User-Agent: KMail/1.13.5 (Linux/2.6.32-5-amd64; KDE/4.4.5; x86_64; ; ) References: <201009261813.27244.sf@sfritsch.de> <401DEDD7-E5B5-41CE-BFA1-11996490AAA4@jaguNET.com> In-Reply-To: <401DEDD7-E5B5-41CE-BFA1-11996490AAA4@jaguNET.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201009271628.01835.sf@sfritsch.de> On Monday 27 September 2010, Jim Jagielski wrote: > On Sep 27, 2010, at 9:19 AM, Jim Jagielski wrote: > > On Sep 27, 2010, at 8:17 AM, Jim Jagielski wrote: > >> Let me look... > >> > >> On Sep 26, 2010, at 12:13 PM, Stefan Fritsch wrote: > >>> Hi, > >>> > >>> mod_slotmem_shm creates a new global pool on every graceful > >>> restart but never destroys it. > >>> > >>> From quickly looking at the code it is not clear to me what the > >>> correct behaviour would be. Should the pool be created from > >>> pconf instead? Or should it be destroyed in cleanup_slotmem()? > > > > creating from pconf is cleaner... > > Hold on a tic... I'm not seeing the leak. During > cleanup_slotmem we do destroy next->gpool which > is set to gpool. Hmm. There seem to be two issues here: If no other module uses shm slotmem (i.e. slotmem_create() is never called), globallistmem stays NULL and the cleanup does nothing. In this case gpool is leaked every time. The pool is created on every call to pre_config, but the cleanup is registered only on the second and subsequent calls to post_config. In this case only the first gpool is leaked. BTW, it is not that obvious that the shm is supposed to be cleaned up and re-created on graceful restarts. This should be documented in the code.