Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XNKNG-0001Dw-Ty for pgsql-bugs@arkaria.postgresql.org; Fri, 29 Aug 2014 11:29:47 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XNKNG-0003Bb-EL for pgsql-bugs@arkaria.postgresql.org; Fri, 29 Aug 2014 11:29:46 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XNKNF-0003BV-Op for pgsql-bugs@postgresql.org; Fri, 29 Aug 2014 11:29:45 +0000 Received: from smtp-outbound-2.vmware.com ([208.91.2.13]) by magus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1XNKNB-0004BW-0o for pgsql-bugs@postgresql.org; Fri, 29 Aug 2014 11:29:44 +0000 Received: from sc9-mailhost2.vmware.com (sc9-mailhost2.vmware.com [10.113.161.72]) by smtp-outbound-2.vmware.com (Postfix) with ESMTP id A147C29775; Fri, 29 Aug 2014 04:29:35 -0700 (PDT) Received: from EX13-CAS-013.vmware.com (EX13-CAS-013.vmware.com [10.113.191.65]) by sc9-mailhost2.vmware.com (Postfix) with ESMTP id 9040BB175F; Fri, 29 Aug 2014 04:29:35 -0700 (PDT) Received: from EX13-MBX-024.vmware.com (10.113.191.44) by EX13-MBX-008.vmware.com (10.113.191.28) with Microsoft SMTP Server (TLS) id 15.0.775.38; Fri, 29 Aug 2014 04:29:35 -0700 Received: from [192.168.1.90] (10.113.160.246) by EX13-MBX-024.vmware.com (10.113.191.44) with Microsoft SMTP Server (TLS) id 15.0.775.38; Fri, 29 Aug 2014 04:29:09 -0700 Message-ID: <540063F6.3060500@vmware.com> Date: Fri, 29 Aug 2014 14:28:54 +0300 From: Heikki Linnakangas Organization: VMware User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Icedove/24.5.0 MIME-Version: 1.0 To: , Subject: Re: BUG #11280: Segmentation fault in dataPlaceToPageLeaf at gindatapage.c:645 References: <20140827115618.2532.50031@wrigleys.postgresql.org> In-Reply-To: <20140827115618.2532.50031@wrigleys.postgresql.org> Content-Type: multipart/mixed; boundary="------------090900010705050309040804" X-Originating-IP: [10.113.160.246] X-ClientProxiedBy: EX13-CAS-013.vmware.com (10.113.191.65) To EX13-MBX-024.vmware.com (10.113.191.44) X-Pg-Spam-Score: -6.9 (------) 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 --------------090900010705050309040804 Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit On 08/27/2014 02:56 PM, marten.svantesson@ticket.se wrote: > The following bug has been logged on the website: > > Bug reference: 11280 > Logged by: MÃ¥rten Svantesson > Email address: marten.svantesson@ticket.se > PostgreSQL version: 9.4beta2 > Operating system: RHEL 6 kernel 2.6.32 > Description: > > As can be seen below one crash occurred during an insert to a table with a > gin index. (The table actually has 2 gin indexes.) The insert is done from > an import job where several inserts may be done in parallel. Also a similar > import is executed concurrently in another database of the cluster. > > The crash hasn't happened to me with a clean index (reindex recently done). > So I can not give an exact step by step account of how to reproduce this. > The database was migrated from 9.3 with pg_update, but after that both > reindex and analyze full has been done. > > As you can see auto explain is enabled, but I have experienced segmentation > faults in 9.4 without it enabled. This was before I had enabled core dumps > so if it was the exact same error I don't know. To get debug symbols I > compiled from the source tarball of 9.4beta2. Configure was run with > > ./configure --without-readline --enable-cassert --enable-debug CFLAGS="-ggdb > -fno-omit-frame-pointer" > > The gin indexes on this table (and the whole database) are > > CREATE INDEX offer_departurecode_o_badges_idx > ON offer > USING gin > (departurecode_o, badges); > > CREATE INDEX offer_badges_idx > ON offer > USING gin > (badges); > > where departurecode_o is defined as character varying(255) and badges as > bigint[]. The number of distinct values of departurecode_o is low: 26 in a > table with a bit over 2 million rows. The badges column is not present in > the insert. > > # gdb /usr/pgsql-9.4/bin/postgres core.17901 > > Core was generated by `postgres: test test_se xxx.xxx.xxx.xxx(41959) INSERT > '. > Program terminated with signal 11, Segmentation fault. > #0 0x0000000000473e04 in dataPlaceToPageLeaf (btree=0x7fff50edab40, > buf=66863, stack=0x2c520f0, insertdata=0x7fff50edab30, > prdata=0x7fff50edaa20, newlpage=0x7fff50edaa18, newrpage=0x7fff50edaa10) at > gindatapage.c:645 > 645 segsize = SizeOfGinPostingList(lastleftinfo->seg); Hmm. What seems to be happening is that this code that chooses the best split location doesn't take into account that the list of posting lists it's walking through can contain placeholders for posting lists that were deleted altogether (e.g. because it was merged with the next list). The SizeOfGinPostingList call fails for such items. So, this is not related to pg_upgrade or autoexplain, but a garden-variety bug in the page-splitting code. I was able to reproduce this with the attached script. I have committed a fix, which will appear in the next 9.4 beta release (of if there isn't any more betas, the final release). Thanks for the report! - Heikki --------------090900010705050309040804 Content-Type: application/sql; name="ginbug.sql" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="ginbug.sql" ZHJvcCB0YWJsZSBpZiBleGlzdHMgZ2ludGVzdDsKCmNyZWF0ZSB0YWJsZSBn aW50ZXN0IChpIGludDQpOwppbnNlcnQgaW50byBnaW50ZXN0IHNlbGVjdCBn IGZyb20gZ2VuZXJhdGVfc2VyaWVzKDEsIDc5NjMpIGc7CgpjcmVhdGUgaW5k ZXggaV9naW50ZXN0IG9uIGdpbnRlc3QgdXNpbmcgZ2luICgoJ3sxfSc6Omlu dDRbXSkpIHdpdGggKGZhc3R1cGRhdGU9b24pIHdoZXJlIGkgPiAwIDsKCgpz ZWxlY3QgKiBmcm9tICBnaW5fZGF0YWxlYWZwYWdlKGdldF9yYXdfcGFnZSgn aV9naW50ZXN0JywgMikpOwoKLS0gRGVsZXRlIHNvbWUgaXRlbXMsIHNvIHRo YXQgb25lIHNlZ21lbnQgYmVjb21lcyB2ZXJ5IHNtYWxsLgpkZWxldGUgZnJv bSBnaW50ZXN0IHdoZXJlIGkgYmV0d2VlbiA3MTUwIGFuZCA3NTAwOwp2YWN1 dW0gZ2ludGVzdDsKCi0tIEluc2VydCBtb3JlIHR1cGxlcywgdG8gb2NjdXB5 IHRoZSBzcGFjZS4gVGhlc2UgYXJlIG5vdCBpbmNsdWRlZCBpbiB0aGUgaW5k ZXgKaW5zZXJ0IGludG8gZ2ludGVzdCBzZWxlY3QgLWcgZnJvbSBnZW5lcmF0 ZV9zZXJpZXMoMSwgMzUwKSBnOwoKc2VsZWN0ICogZnJvbSAgZ2luX2RhdGFs ZWFmcGFnZShnZXRfcmF3X3BhZ2UoJ2lfZ2ludGVzdCcsIDIpKTsKCi0tIGlu c2VydCBtb3JlIGl0ZW1zLCBjYXVzaW5nIGEgc3BsaXQKaW5zZXJ0IGludG8g Z2ludGVzdCBzZWxlY3QgZyBmcm9tIGdlbmVyYXRlX3NlcmllcygxLCAxMDAw KSBnOwp2YWN1dW0gZ2ludGVzdDsK --------------090900010705050309040804 Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs --------------090900010705050309040804--