Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iX1sh-0004vC-ON for pgsql-bugs@arkaria.postgresql.org; Tue, 19 Nov 2019 11:41: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 1iX1sg-0003Ef-HH for pgsql-bugs@arkaria.postgresql.org; Tue, 19 Nov 2019 11:41:14 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iX1se-0003EX-Hz for pgsql-bugs@lists.postgresql.org; Tue, 19 Nov 2019 11:41:14 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iX1sW-0002Ct-34 for pgsql-bugs@lists.postgresql.org; Tue, 19 Nov 2019 11:41:12 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 9A04E22373; Tue, 19 Nov 2019 06:41:01 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Tue, 19 Nov 2019 06:41:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm3; bh=ulBugsi4ZK5Lj9uSeVliKGBuiS2 m/S1WI7fwPUFP1x0=; b=NojnnFNuqZAFIg/NzJag3zwO4i48Db+KKiG2d+blMdB IJDNYmlKVUW9qPXN11gT/Wg1AllP7o1lH9ZBCio9L6FF95BgXgaaAddnEibf+nUf fRhm1a7UXk/8BoE8oiSxA/ve0wWhtzBNKUWFswdFCc47pflpfH2R5qXq1xmG9Gpu 2Ox5uPM+qySGb9yztoQOJfWeJ23RoRJtT8JhPgHgSZtOTDylpncIMPco80QAVihX UebE8e9AdZIJCA88Hof0YAxVXCM9I9acxfeQQUh+Kdx7+jc8x1krRtqWo275ItHo kL/WTWZtsH5IJ9cxIMpkxCaj/nrW2L+JN+4gjK21xLA== 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=ulBugs i4ZK5Lj9uSeVliKGBuiS2m/S1WI7fwPUFP1x0=; b=ELhgV3MEzdKo998QaMxQ9C EZXGHDSA1HsVgJafJvA8inJVtOliZE8UH2fk/UX7o7HlcbuiixmNEPZxhHOzcmGc eTQ+sNOVcOHjT/aE6zopzfiuTvLjqOiikU/50pP7vVkQ/RXWneGrkrT5p7+eq7xB QWEDyzg/U4jAEezmB4CWaFfPP3Bk93cnDdur3+jFx+4nPwRGPVHCTOJsJcPwcL5J J28w7RONosnffr47E3hQYD5hNXdDpIHW7yymWpbmZrzYUzeY8Al9O7UFR1uh8Ki8 t8BgVHCUeMuKBZs2oKbzI6p1Qbd2PQ/qd1q7EXW2nZdxzsqKBCbCq2srIOPeOVcg == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrudegkedgfedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne gfrhhlucfvnfffucdlfeehmdenucfjughrpeffhffvuffkfhggtggujgesghdtreertddt vdenucfhrhhomhepofhitghhrggvlhcurfgrqhhuihgvrhcuoehmihgthhgrvghlsehprg hquhhivghrrdighiiiqeenucfkphepudduuddruddtvddrudektddrudekheenucfrrghr rghmpehmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiihiienucevlh hushhtvghrufhiiigvpedt X-ME-Proxy: Received: from paquier.xyz (ee0822lan1.rev.em-net.ne.jp [111.102.180.185]) by mail.messagingengine.com (Postfix) with ESMTPA id 406BE3060064; Tue, 19 Nov 2019 06:41:00 -0500 (EST) Date: Tue, 19 Nov 2019 20:40:56 +0900 From: Michael Paquier To: Tomas Vondra Cc: Adam Scott , pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16122: segfault pg_detoast_datum (datum=0x0) at fmgr.c:1833 numrange query Message-ID: <20191119114056.GA516103@paquier.xyz> References: <16122-eb35bc248c806c15@postgresql.org> <20191118120312.cblcswef6vuqbijq@development> <20191119014827.GC1614@paquier.xyz> <20191119103813.xnsloisoxkwrxoim@development> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="RnlQjJ0d97Da+TV1" Content-Disposition: inline In-Reply-To: <20191119103813.xnsloisoxkwrxoim@development> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --RnlQjJ0d97Da+TV1 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Nov 19, 2019 at 11:38:13AM +0100, Tomas Vondra wrote: > FWIW I've managed to reproduce this on 10, but I had to build without > --enable-cassert. So this does trigger the issue: >=20 > Haven't investigated further yet. If you add an ANALYZE on the table natica_hdu_test after restoring, I am rather sure that you would reproduce the crash more quickly because the handling around the stats of the column are busted here. Anyway, taking my example of upthread, I have been also able to reproduce the problem on REL_10_STABLE even with assertions enabled: the trick is that you need to leave once the session after the analyze on the table. Then a SELECT within a new session is enough to crash the server. The change with stdbool.h actually makes the crash easier to reproduce as there is no need to leave the session. I am not sure how it mattered.. [ ... And one bisect later ... ] This looks more correct as culprit than the precedent because it touches the area of the crash: commit: 9aab83fc5039d83e84144b7bed3fb1d62a74ae78 author: Tom Lane date: Sat, 13 May 2017 15:14:39 -0400 Redesign get_attstatsslot()/free_attstatsslot() for more safety and speed. It seems to me that that we are simply free'ing an area which still needs to be accessed for the stat estimations. -- Michael --RnlQjJ0d97Da+TV1 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAl3T1MgACgkQnvQgOdby QH09hRAAosfsA+Tno01tbBOq2fxvVgJikhim3pYfnuALBn+jtoR2WxagmXKti0Z2 K4QBY8nKQH4JlG0ZsyFeV1aK4faSIl6kHcajg6NRQVLYwAdokHO/GpFBQUyhJgEV OA1rSRmwf66B7R2w4uZ6SW4J+saSfGbRk8OMh0vMurlJlkNvLVlwHUCkmFR1drkL asNJOfmem+Guy2+2PBInZ36iqwpM5zSzkABuXHSUkJhNGHYnjQGVZjK/+sjKAEsB RiXTB8il05HugOG+OLMP7x2D4MBd1D0hV37fE1p3f0m8e4xiczsgBn6Q5HfxuoxL bKQXWW6T17aPoHIDpNRpyJCKI86vM0DLg8+SNn2Tw1cs1g0Dhkqww/pMOyAYDd7d aNkehsTPSHDDf9dzYlYlaBpzagsn+YTbXDoq1+WyK9utNBd/piVdmJiRwBAmFVFg n/YAR0H7aOs1y3rvIavgizYj7p71V/FIlHu9b2sl2qMAOhIDNrPiI/cNlO+kU7wS W+Pyc4ogFkZZ1FLeZrb+gsINksBsEIwYejJ0mJ+rszaLBlQPBErsJJ2wXOBBiy+H dbQmCghsRO5eLe3KYzxB8bI9JnJFfmj/iuEw9p26QRmBHGYRyTssG/gXQ7oZoj2o Xye1g1Copm8zUsawwL+5egJi8pNYqHLle2kRG3KIY+csPZhYdEc= =si63 -----END PGP SIGNATURE----- --RnlQjJ0d97Da+TV1--