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 1iWfka-0001ae-Mc for pgsql-bugs@arkaria.postgresql.org; Mon, 18 Nov 2019 12:03:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iWfkY-0000YG-93 for pgsql-bugs@arkaria.postgresql.org; Mon, 18 Nov 2019 12:03:22 +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 1iWfkX-0000Y8-UE for pgsql-bugs@lists.postgresql.org; Mon, 18 Nov 2019 12:03:22 +0000 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iWfkU-0006k7-Mb for pgsql-bugs@lists.postgresql.org; Mon, 18 Nov 2019 12:03:21 +0000 Received: by mail-wm1-x343.google.com with SMTP id b11so17086117wmb.5 for ; Mon, 18 Nov 2019 04:03:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=H5Xub67TndtkDj6niWwAPyfVI1ef65WPUahirMfAvJg=; b=ThPq2rPQcnMFFAun+mVJQM5KR4z2j/DCIw1iTafT3CQ3rFbT4engr9j9kgX4tw6v22 BTyo3P4QU5U/RbpBM91uJcthGLW3LwRsR2E2kz+A03GtD+oJmaofgC2FDvlJ8i+Jl9cV wL8Cvfhvd0PYSk7u0CjwKgkzMCob/q38BGf2XCFCTuMpWvutpcqIpW1RMpziiVY1jX6+ fxpyyrjcdfK8yURQpVhbbWDuU6ESz/WonoEJdhUEUyW1ingdT3x38u7QOiL0QPbWJKqJ z/GZgE7CK6aOGS9pcFRj0Cp4dHR/crb3USsTJB1AoF8p0WapfCsjj06brgOy1FLg7Yq/ XY3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=H5Xub67TndtkDj6niWwAPyfVI1ef65WPUahirMfAvJg=; b=BHBhbJB0z3fz028l5n1DOEx6U8HhI6nyucnBJWAa4fJeoRfgdoFWNFSPtaHa5Nz3Rp c6+Bl8Bm8Y1fXH7XqabD87vFGwMVi0WiNKTlui9b6LVfa3uYrxA4VCcQ9DNeBtOFwBj9 CYUdWSsMvTwzlF+EzNuoCGZIshLxKsT+VES+BJVXHHEElXfAXYZYhoiJcdP2LIXHCnnS 3yhXxwzbcfty1VZ8Bi5gU08UYietiQbHZBvmkVoZ41J6iWXTTMgGpKFlVRAY1zNVcWLz u9ONqskuHyHOYdEkJh94UVbBdGLY9RFmawDqgzbgqXXxO4xUTcCh74jL5Cg2Lv1aH3RT XLXQ== X-Gm-Message-State: APjAAAX+rtYEvfBTeWVFe0ohOg5PihaAVrWWD+Kkr+SiVKASf6QSWF68 oEh8ukvHgxmprDXqAMUajd6aDA== X-Google-Smtp-Source: APXvYqy9zET3xjQPjcZd7jDKNzaHkfXhxCD37VF1l1OvP9IjucdiY/C0YYnvpPMtwOtdu8uIa9BMjg== X-Received: by 2002:a1c:7f54:: with SMTP id a81mr29510483wmd.48.1574078597648; Mon, 18 Nov 2019 04:03:17 -0800 (PST) Received: from localhost (static-84-42-175-93.net.upcbroadband.cz. [84.42.175.93]) by smtp.gmail.com with ESMTPSA id a26sm11836899wmm.14.2019.11.18.04.03.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Nov 2019 04:03:14 -0800 (PST) Date: Mon, 18 Nov 2019 13:03:12 +0100 From: Tomas Vondra To: adam.c.scott@gmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16122: segfault pg_detoast_datum (datum=0x0) at fmgr.c:1833 numrange query Message-ID: <20191118120312.cblcswef6vuqbijq@development> References: <16122-eb35bc248c806c15@postgresql.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <16122-eb35bc248c806c15@postgresql.org> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi Adam, thanks for the report. On Mon, Nov 18, 2019 at 01:27:22AM +0000, PG Bug reporting form wrote: >The following bug has been logged on the website: > >Bug reference: 16122 >Logged by: ascott >Email address: adam.c.scott@gmail.com >PostgreSQL version: 10.11 >Operating system: Ubuntu & CentOS >Description: > >Seg fault can be repeated by running this query: > >select count(*) from natica_hdu where boundary is not null >and >"dec_range" <@ '[89.9999998611111,90.0000001388889)' AND "ra_range" <@ >'[45.0,45.1]'; > >it crashes on this line: > >if (VARATT_IS_EXTENDED(datum)) in fmgr.c:1833 > >GDB stacktrace is below. > Hmmm, this does seem like some sort of memory/data corruption, probably. But I'm unable to reproduce the issue, it's likely data dependent. Can you try extracting a data set reproducing the issue? Not sure how large or sensitive the data is, but if needed you can share it off-list. >The table definition for natica_hdu is as follows: >CREATE TABLE public.natica_hdu >( > id integer NOT NULL, > updated timestamp with time zone NOT NULL, > hdu_idx smallint NOT NULL, > ra double precision, > "dec" double precision, > boundary double precision[], > extras jsonb NOT NULL, > fitsfile_id character varying(32) NOT NULL, > dec_range numrange, > ra_range numrange >) >WITH ( > OIDS=FALSE >); Hm, the query only really touches dec_range and ra_range. If you try just select count(*) from natica_hdu where "dec_range" <@ '[89.9999998611111,90.0000001388889)' and select count(*) from natica_hdu where "ra_range" <@ '[45.0,45.1]' does either of those queries crash too? That would reduce the amount of data for the reproducer. If you try just COPY (SELECT ra_range, dec_range FROM public.natica_hdu) TO '/dev/null'; does that fail too? If yes, it's likely due to on-disk data corruption. If not, it seems more like a memory corruption during processing. I think the grants and indexes are mostly irrelevant for the issue, particularly those not related to columns in the query. Did you include just because they are defined, or because you think it's actually related? >ALTER TABLE public.natica_hdu > OWNER TO postgres; > >CREATE INDEX natica_hdu_dec_range_56c7d92d > ON public.natica_hdu > USING btree > (dec_range); > >CREATE INDEX natica_hdu_fitsfile_id_3a3363fe > ON public.natica_hdu > USING btree > (fitsfile_id COLLATE pg_catalog."default"); > >CREATE INDEX natica_hdu_fitsfile_id_3a3363fe_like > ON public.natica_hdu > USING btree > (fitsfile_id COLLATE pg_catalog."default" varchar_pattern_ops); > > >CREATE INDEX natica_hdu_q3c_ang2ipix_idx > ON public.natica_hdu > USING btree > (q3c_ang2ipix(ra, "dec")); >ALTER TABLE public.natica_hdu CLUSTER ON natica_hdu_q3c_ang2ipix_idx; > >CREATE INDEX natica_hdu_ra_range_b9f4d3ac > ON public.natica_hdu > USING btree > (ra_range); ... regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services