Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b9aOE-00028w-Sb for pgsql-bugs@arkaria.postgresql.org; Sun, 05 Jun 2016 15:55:02 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1b9aOE-0005Gy-Aa for pgsql-bugs@arkaria.postgresql.org; Sun, 05 Jun 2016 15:55:02 +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 1b9aOD-0005Gq-Ul for pgsql-bugs@postgresql.org; Sun, 05 Jun 2016 15:55:02 +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.84_2) (envelope-from ) id 1b9aOB-0000zM-7k for pgsql-bugs@postgresql.org; Sun, 05 Jun 2016 15:55:00 +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 u55FsuGq000561; Sun, 5 Jun 2016 11:54:56 -0400 From: Tom Lane To: Peter Geoghegan cc: Euler Taveira , Jihyun Yu , pgsql-bugs Subject: Re: BUG #14134: segmentation fault with large table with gist index In-reply-to: References: <20160511154904.2603.43889@wrigleys.postgresql.org> <57336236.3060200@timbira.com.br> Comments: In-reply-to Peter Geoghegan message dated "Mon, 30 May 2016 14:00:39 -0700" Date: Sun, 05 Jun 2016 11:54:56 -0400 Message-ID: <560.1465142096@sss.pgh.pa.us> X-Pg-Spam-Score: -3.3 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Peter Geoghegan writes: > My previous analysis on why this occurred so infrequently as to only > see a problem report months after a stable release was wrong. This bug > only happens in narrow situations where a distance function exists > that is indexable by GiST, while that also lacks SortSupport. GiST > isn't doing anything with any other SortSupport attribute that lacks a > distance operator. > The lack of SortSupport will make SortSupport use a shim comparator, > which tries to use caller's memory context, which was found to be NULL > (since we palloc0()). So, this bug is fairly narrow in practice, > because you had to be using the distance operator for interval, which > looks like the only example of where this is possible. > Attached patch fixes the bug by initializing the SortSupport states used. Pushed. I added an explicit initialization of orderbysort->abbreviate, because all the other callers of PrepareSortSupportFromOrderingOp make a point of setting that. Also a regression test. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs