From dev-return-18209-apmail-apr-dev-archive=apr.apache.org@apr.apache.org Thu Mar 22 16:42:29 2007 Return-Path: Delivered-To: apmail-apr-dev-archive@www.apache.org Received: (qmail 52849 invoked from network); 22 Mar 2007 16:42:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 22 Mar 2007 16:42:28 -0000 Received: (qmail 99795 invoked by uid 500); 22 Mar 2007 16:42:34 -0000 Delivered-To: apmail-apr-dev-archive@apr.apache.org Received: (qmail 99756 invoked by uid 500); 22 Mar 2007 16:42:34 -0000 Mailing-List: contact dev-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Id: Delivered-To: mailing list dev@apr.apache.org Received: (qmail 99745 invoked by uid 99); 22 Mar 2007 16:42:34 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 22 Mar 2007 09:42:34 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of jorton@redhat.com designates 66.187.233.31 as permitted sender) Received: from [66.187.233.31] (HELO mx1.redhat.com) (66.187.233.31) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 22 Mar 2007 09:42:26 -0700 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.1/8.13.1) with ESMTP id l2MGg50q004721 for ; Thu, 22 Mar 2007 12:42:05 -0400 Received: from radish.cambridge.redhat.com (radish.cambridge.redhat.com [172.16.18.90]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id l2MGg3LB007874 for ; Thu, 22 Mar 2007 12:42:04 -0400 Received: from radish.cambridge.redhat.com (localhost.localdomain [127.0.0.1]) by radish.cambridge.redhat.com (8.13.8/8.13.7) with ESMTP id l2MGg3N8018936 for ; Thu, 22 Mar 2007 16:42:03 GMT Received: (from jorton@localhost) by radish.cambridge.redhat.com (8.13.8/8.13.8/Submit) id l2MGg39H018935 for dev@apr.apache.org; Thu, 22 Mar 2007 16:42:03 GMT Date: Thu, 22 Mar 2007 16:42:03 +0000 From: Joe Orton To: APR Development List Subject: Re: apr_file_gets()/apr_file_read() locking problem Message-ID: <20070322164202.GB17343@redhat.com> Mail-Followup-To: APR Development List References: <1174529721.3130.20.camel@shrek.rexursive.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1174529721.3130.20.camel@shrek.rexursive.com> User-Agent: Mutt/1.4.2.1i X-Virus-Checked: Checked by ClamAV on apache.org On Thu, Mar 22, 2007 at 01:15:21PM +1100, Bojan Smojver wrote: > I just bumped into this today with 1.2.x, but the code is more or less > the same in trunk. I opened a temporary file with apr_file_mktemp(), > which in turn opened an APR file with a mutex (not sure why, but that's > what happened on FC6 ). So far, so good. > > If apr_file_gets() is called on that file, mutex is locked (line 340 in > trunk of readwrite.c) in this function. However, this function then > calls apr_file_read(), which attempts to lock the same mutex again (line > 45 in trunk of readwrite.c), which hangs the program. That definitely looks broken. Either the buffered read code needs to be factored out of apr_file_read so it can be called here, or _gets could just fall back on the slow !buffered path if flags & APR_XTHREAD (ugly but safe). joe