Return-Path: Delivered-To: apmail-httpd-dev-archive@www.apache.org Received: (qmail 63130 invoked from network); 18 May 2010 07:58:15 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 18 May 2010 07:58:15 -0000 Received: (qmail 59908 invoked by uid 500); 18 May 2010 07:58:14 -0000 Delivered-To: apmail-httpd-dev-archive@httpd.apache.org Received: (qmail 59781 invoked by uid 500); 18 May 2010 07:58:12 -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 59766 invoked by uid 99); 18 May 2010 07:58:11 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 May 2010 07:58:11 +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 (nike.apache.org: local policy) Received: from [195.232.224.75] (HELO mailout06.vodafone.com) (195.232.224.75) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 18 May 2010 07:58:01 +0000 Received: from mailint06 (localhost [127.0.0.1]) by mailout06 (Postfix) with ESMTP id 58CF484647 for ; Tue, 18 May 2010 09:57:40 +0200 (CEST) Received: from avoexs01.internal.vodafone.com (unknown [145.230.4.134]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (No client certificate requested) by mailint06 (Postfix) with ESMTPS id 4CA5B84640; Tue, 18 May 2010 09:57:40 +0200 (CEST) Received: from VF-MBX11.internal.vodafone.com ([145.230.5.21]) by avoexs01.internal.vodafone.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 18 May 2010 09:57:41 +0200 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: RE: File descriptor leak with mpm-event / apr file bucket cleanup Date: Tue, 18 May 2010 09:57:39 +0200 Message-ID: <99EA83DCDE961346AFA9B5EC33FEC08B03E6CB80@VF-MBX11.internal.vodafone.com> In-reply-to: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: File descriptor leak with mpm-event / apr file bucket cleanup Thread-Index: Acr2WmLflpwTZXMbSr6kyxVxNnnczQABUMuA References: <201005172311.39558.sf@sfritsch.de> <4BF22B2E.5000304@apache.org> From: =?iso-8859-1?Q?=22Pl=FCm=2C_R=FCdiger=2C_VF-Group=22?= To: Cc: X-OriginalArrivalTime: 18 May 2010 07:57:41.0560 (UTC) FILETIME=[CAA4BB80:01CAF65F] X-Virus-Checked: Checked by ClamAV on apache.org =20 > -----Original Message----- > From: Stefan Fritsch [mailto:sf@sfritsch.de]=20 > Sent: Dienstag, 18. Mai 2010 09:18 > To: dev@httpd.apache.org > Cc: dev@apr.apache.org > Subject: Re: File descriptor leak with mpm-event / apr file=20 > bucket cleanup >=20 > On Tue, 18 May 2010, Ruediger Pluem wrote: > >> --- buckets/apr_buckets_file.c.dist +0200 > >> +++ buckets/apr_buckets_file.c > >> @@ -34,8 +34,7 @@ > >> apr_bucket_file *f =3D data; > >> > >> if (apr_bucket_shared_destroy(f)) { > >> - /* no need to close the file here; it will get > >> - * done automatically when the pool gets cleaned up */ > >> + apr_file_close(f->fd); > >> apr_bucket_free(f); > >> } > >> } > >> > >> > > > > I guess this would be wrong. Think of the following scenario. > > > > 1. A brigade with a file bucket. > > 2. The file bucket is split into two file buckets during=20 > processing in the > > filter chain. > > 3. The first bucket is processed and destroyed. This would=20 > leave the second > > file bucket with an closed file descriptor. > > > > So if you want to close this fd you IMHO would need to do=20 > some refcounting > > and only close it if no other filebucket still references it. >=20 > The filebuckets already do refcounting.=20 > apr_bucket_shared_destroy(f) in=20 > the patch above is only true if the refcount has reached zero. >=20 Good point. I missed that. Regards R=FCdiger