Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n7suk-0006Dx-07 for pgsql-hackers@arkaria.postgresql.org; Thu, 13 Jan 2022 05:44:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1n7sui-0006H1-Ji for pgsql-hackers@arkaria.postgresql.org; Thu, 13 Jan 2022 05:44:44 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n7sui-0006Gs-A4 for pgsql-hackers@lists.postgresql.org; Thu, 13 Jan 2022 05:44:44 +0000 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n7sub-0000c1-Cy for pgsql-hackers@lists.postgresql.org; Thu, 13 Jan 2022 05:44:43 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id D6E503201D9C; Thu, 13 Jan 2022 00:44:35 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Thu, 13 Jan 2022 00:44:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm3; bh=RrA/blPlqR231ODIKZwKUpvko7z Wliy4U8Yys8X63Kk=; b=xL1Kb8xi/jQqrbWhtwG6BqP7lxy3PlCEWrUfTJrGiOg dMY4ZJURp3EzHGAhqBRnLO6jK9ScTI7H71hV+A7VzYN/RkD+AVyNPDCdRoMSWzhF xO5GGaKNPDNfUzgp9OurtA1OlL3yCX1Z77BuyauGIIKJpgUEA6QmRiE2B5sIm3o6 gKVrG1tcwGBw9m5PO6nzmGShKPzdKkNgllT8q73HMZwWAaDfSJI7vrlfpRdhi8G8 dvCkyXkkgiYNunLNK4G2bPB+U2P+WPM+slVaeA/Gb817Lju6nVr6OOP1YdyJRaXD UPbRX/8WwgYpDMnlwNFfi5MMGOWG+gWEu5LviCUsfCQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=RrA/bl PlqR231ODIKZwKUpvko7zWliy4U8Yys8X63Kk=; b=DsZ/T2FuumVX8RGkAZ1q1g saWQAn/h4rfIIiDZ6Sc5qpgg0Zq3IPJNUdtsAIU72WMyzMcnpktQUylRaAhczTSk 9QKTMaefmZe+xAqyZTslomYmqPTgcmNXJIS71QIA3/ir+Gg1QGQcYtRYGT48yZi7 KEuOk0JAhMzJIJvqp4Ng7rfjQxnC8OMAA5EbHSZPKYpbuKpSQOdKKc3O4fow0GOV 8TcQyQl9SxE6sg9High+BNSzeqxvQeFg1tJSEsiHqkvJOF/qXA/17mBWRV+GUQRD B3wD1yR0SsDkU8mvIqVrNDPHcf/dHMwKqUanPchsR0LXpsQIZKV1gew6zC9g1shw == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrtddvgdekiecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvuffkfhggtggujgesthdtredttddtvdenucfhrhhomheptehnughrvghs ucfhrhgvuhhnugcuoegrnhgurhgvshesrghnrghrrgiivghlrdguvgeqnecuggftrfgrth htvghrnhepffdvvdevleelgffhheeitdevhfefgfeivdevieeltdffkeefgffguedtkeei heejnecuffhomhgrihhnpehpohhsthhgrhdrvghsnecuvehluhhsthgvrhfuihiivgeptd enucfrrghrrghmpehmrghilhhfrhhomheprghnughrvghssegrnhgrrhgriigvlhdruggv X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 13 Jan 2022 00:44:34 -0500 (EST) Date: Wed, 12 Jan 2022 21:44:33 -0800 From: Andres Freund To: Fabien COELHO Cc: Peter Eisentraut , "pgsql-hackers@lists.postgresql.org" Subject: Re: psql - add SHOW_ALL_RESULTS option Message-ID: <20220113054433.wdjhidtm7gvyhfts@alap3.anarazel.de> References: <18c78a01-4a34-9dd4-f78b-6860f1420c8e@enterprisedb.com> <6954328d-96f2-77f7-735f-7ce493a40949@enterprisedb.com> <2570e2ae-fa0f-aac9-f72f-bb59a9983a20@enterprisedb.com> <46259d13-5f90-1475-3c85-d7a597a2b862@enterprisedb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 2022-01-08 19:32:36 +0100, Fabien COELHO wrote: > Attached v13 where the crash test is moved to tap. The reason this test constantly fails on cfbot windows is a use-after-free bug. I figured that out in the context of another thread, so the debugging is there: https://postgr.es/m/20220113054123.ib4khtafgq34lv4z%40alap3.anarazel.de > Ah, I see the bug. It's a use-after-free introduced in the patch: > > SendQueryAndProcessResults(const char *query, double *pelapsed_msec, > bool is_watch, const printQueryOpt *opt, FILE *printQueryFout, bool *tx_ended) > > > ... > /* first result */ > result = PQgetResult(pset.db); > > > while (result != NULL) > > > ... > if (!AcceptResult(result, false)) > { > ... > ClearOrSaveResult(result); > success = false; > > > /* and switch to next result */ > result_status = PQresultStatus(result); > if (result_status == PGRES_COPY_BOTH || > result_status == PGRES_COPY_OUT || > result_status == PGRES_COPY_IN) > > > So we called ClearOrSaveResult() with did a PQclear(), and then we go and call > PQresultStatus(). Greetings, Andres Freund