Return-Path: X-Original-To: apmail-httpd-dev-archive@www.apache.org Delivered-To: apmail-httpd-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D51AB10FCF for ; Tue, 3 Mar 2015 11:16:37 +0000 (UTC) Received: (qmail 59132 invoked by uid 500); 3 Mar 2015 11:16:31 -0000 Delivered-To: apmail-httpd-dev-archive@httpd.apache.org Received: (qmail 59061 invoked by uid 500); 3 Mar 2015 11:16:31 -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 59043 invoked by uid 99); 3 Mar 2015 11:16:31 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Mar 2015 11:16:31 +0000 X-ASF-Spam-Status: No, hits=-5.0 required=5.0 tests=RCVD_IN_DNSWL_HI,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of jkaluza@redhat.com designates 209.132.183.28 as permitted sender) Received: from [209.132.183.28] (HELO mx1.redhat.com) (209.132.183.28) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Mar 2015 11:16:05 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t23BD2tP031495 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Tue, 3 Mar 2015 06:13:02 -0500 Received: from dhcp-24-191.brq.redhat.com ([10.40.204.27]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t23BD0SL018925 for ; Tue, 3 Mar 2015 06:13:01 -0500 Message-ID: <54F5973C.6010800@redhat.com> Date: Tue, 03 Mar 2015 12:13:00 +0100 From: =?UTF-8?B?SmFuIEthbHXFvmE=?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: dev@httpd.apache.org Subject: Re: What is the lifetime of apr_dbd_get_entry(...); result? References: <54D2246A.2010709@redhat.com> <54F40F9B.6080909@redhat.com> In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Virus-Checked: Checked by ClamAV on apache.org On 03/02/2015 11:24 AM, Yann Ylavic wrote: > I meant to reply to all... > > On Mon, Mar 2, 2015 at 11:23 AM, Yann Ylavic wrote: >> On Mon, Mar 2, 2015 at 8:22 AM, Jan Kaluža wrote: >>> On 02/04/2015 02:53 PM, Jan Kaluža wrote: >>> >>>> httpd's mod_authn_dbd module currently seems to expect that lifetime of >>>> apr_dbd_get_entry(...) result is the same as of the pool used in >>>> apr_dbd_get_row(...) function. >> >> It seems that the result's lifetime is really the one of the row, but >> mod_authn_dbd keep reading rows (sequentially) to cleanup the results >> (before exiting the loop, probably for connection keepalive purpose). >> >>>> >>>> But this is not a true for at least pgsql backend. Its get_entry >>>> function returns "return PQgetvalue(row->res->res, row->n, n);". >>>> Documentation for PQgetvalue says following: >>>> >>>> "One must explicitly copy the data into other storage if it is to be >>>> used past the lifetime of the PGresult structure itself." >>>> >>>> res->res is also freed in dbd_pgsql_get_row(...). >> >> Only the results out-of-range are freed (wrt asked rownum), but not >> the current one(s). >> >>>> >>>> Is that correct behaviour and httpd's mod_authn_dbd module should strdup >>>> the result, or is it apr_dbd, which should return result with expected >>>> lifetime? >> >> I think the fix is to be mod_authn_dbd only, APR looks correct here, >> and so is your patch. Thanks for answer, I've committed it in r1663647. >> Regards, >> Yann. Regards, Jan Kaluza