Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f8CUu-00066a-G5 for pgsql-bugs@arkaria.postgresql.org; Mon, 16 Apr 2018 22:21:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1f8CUt-0004pt-0A for pgsql-bugs@arkaria.postgresql.org; Mon, 16 Apr 2018 22:21:15 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f8CUs-0004pk-Mn for pgsql-bugs@lists.postgresql.org; Mon, 16 Apr 2018 22:21:14 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1f8CUq-0006f1-6w for pgsql-bugs@lists.postgresql.org; Mon, 16 Apr 2018 22:21:13 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w3GML6Ik001156; Mon, 16 Apr 2018 18:21:06 -0400 From: Tom Lane To: Peter Geoghegan cc: Alvaro Herrera , Andres Freund , "Vitaly V. Voronov" , PostgreSQL mailing lists Subject: Re: BUG #15144: *** glibc detected *** postgres: postgres smsconsole [local] SELECT: double free or corruption (!pre In-reply-to: References: <20180416174817.3krcrdtfkiwkhj4s@alvherre.pgsql> <29479.1523912165@sss.pgh.pa.us> Comments: In-reply-to Peter Geoghegan message dated "Mon, 16 Apr 2018 15:13:24 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1154.1523917266.1@sss.pgh.pa.us> Date: Mon, 16 Apr 2018 18:21:06 -0400 Message-ID: <1155.1523917266@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Peter Geoghegan writes: > On Mon, Apr 16, 2018 at 1:56 PM, Tom Lane wrote: >> BTW, I notice that in this situation, readtup_heap seems to be >> palloc'ing in the caller's context, but it counts the memory as >> if it were in the tuplestore's context. Somebody's confused there. > I could just kick myself for not going through tuplestore (and its > version of readtup_heap) as part of the 90decdba3 work. Yeah, I should have thought to question that too. tuplestore was originally built by stripping down tuplesort, and at least in the beginning, I'm pretty sure that all these semantic API details were the same. We should likely have made more effort to keep them in sync. (Still, until we've proven that there *is* a bug here, let's not kick ourselves too hard.) regards, tom lane