Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ePYbP-0008KB-UQ for pgsql-bugs@arkaria.postgresql.org; Thu, 14 Dec 2017 18:51:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ePYbO-0005Ij-IT for pgsql-bugs@arkaria.postgresql.org; Thu, 14 Dec 2017 18:51:26 +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.84_2) (envelope-from ) id 1ePYXP-00059z-T4 for pgsql-bugs@lists.postgresql.org; Thu, 14 Dec 2017 18:47:20 +0000 Received: from gauss.credativ.com ([93.94.130.89]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1ePYXI-0002bh-Ac for pgsql-bugs@postgresql.org; Thu, 14 Dec 2017 18:47:18 +0000 Received: from gauss.credativ.com (localhost [127.0.0.1]) by gauss.credativ.com (Postfix) with ESMTP id 1D32C1E18BC; Thu, 14 Dec 2017 19:47:09 +0100 (CET) Received: from oort (fw-front.credativ.com [62.154.226.94]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: ase@gauss.credativ.com) by gauss.credativ.com (Postfix) with ESMTPSA id F26DB1E15B9; Thu, 14 Dec 2017 19:47:08 +0100 (CET) From: Andreas Seltenreich To: Michael Paquier Cc: Bernd Helmle , Peter Geoghegan , PostgreSQL mailing lists Subject: Re: PostgreSQL crashes with SIGSEGV References: <1512661638.9720.34.camel@oopsware.de> <1512724784.9720.39.camel@oopsware.de> X-PGP-Key: 4096R/803D1FFF 2015-02-04 Key fingerprint = 4758 81DC 8539 494D 29B4 692D F587 0601 803D 1FFF X-Now-Playing: Dabrye - No Child of God (Instrumental) / Fabric 26 / Global Communication Date: Thu, 14 Dec 2017 19:47:08 +0100 In-Reply-To: (Michael Paquier's message of "Tue, 12 Dec 2017 12:03:23 +0900") Message-ID: <87po7hm9jn.fsf@credativ.de> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Michael Paquier writes: > Not sure if you can provide this information, but what does the plan > of the query look like? We did some more reducing work on the original query and data. The following testcase reproduces the double free reported by valgrind for me when run against a vanilla REL9_6_STABLE build. regards, Andreas --8<---------------cut here---------------start------------->8--- drop table if exists bug; create table bug (n text, v text, b text, t text); insert into bug select i%9, i%9, i%16 ,i%4096 from generate_series(1,100000) g(i); analyze bug; explain select * from ( select thecube.nv from ( select (n || ' ') || coalesce(v, '') as nv from bug group by ((n || ' ') || coalesce(v, '')) ,cube(b, t) ) thecube where nv = '8 8' ) sub limit 7000; --8<---------------cut here---------------end--------------->8--- QUERY PLAN --------------------------------------------------------------------------------------------------- Limit (cost=13422.32..15747.28 rows=7000 width=32) -> Subquery Scan on thecube (cost=13422.32..27622.49 rows=42754 width=32) -> GroupAggregate (cost=13422.32..27194.95 rows=42754 width=38) Group Key: (((bug.n || ' '::text) || COALESCE(bug.v, ''::text))), bug.b, bug.t Group Key: (((bug.n || ' '::text) || COALESCE(bug.v, ''::text))), bug.b Group Key: (((bug.n || ' '::text) || COALESCE(bug.v, ''::text))) Sort Key: (((bug.n || ' '::text) || COALESCE(bug.v, ''::text))), bug.t Group Key: (((bug.n || ' '::text) || COALESCE(bug.v, ''::text))), bug.t Filter: ((((bug.n || ' '::text) || COALESCE(bug.v, ''::text))) = '8 8'::text) -> Sort (cost=13422.32..13672.32 rows=100000 width=42) Sort Key: (((bug.n || ' '::text) || COALESCE(bug.v, ''::text))), bug.b, bug.t -> Seq Scan on bug (cost=0.00..2041.00 rows=100000 width=42)