Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eZJri-0000Ek-Ik for pgsql-general@arkaria.postgresql.org; Wed, 10 Jan 2018 17:08:38 +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 1eZJri-000258-5u for pgsql-general@arkaria.postgresql.org; Wed, 10 Jan 2018 17:08:38 +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 1eZJrh-00024s-Qs for pgsql-general@lists.postgresql.org; Wed, 10 Jan 2018 17:08:37 +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.89) (envelope-from ) id 1eZJrf-0007tv-3N for pgsql-general@postgresql.org; Wed, 10 Jan 2018 17:08:36 +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 w0AH8WUN015632; Wed, 10 Jan 2018 12:08:32 -0500 From: Tom Lane To: Glauco Torres cc: pgsql-general@postgresql.org Subject: Re: Segmentation fault with core dump In-reply-to: References: Comments: In-reply-to Glauco Torres message dated "Wed, 10 Jan 2018 09:49:01 -0200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <15630.1515604112.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Wed, 10 Jan 2018 12:08:32 -0500 Message-ID: <15631.1515604112@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Glauco Torres writes: > (gdb) bt > #0 ckpt_buforder_comparator (pa=3Dpa@entry=3D0x7f6fa9ef4b2c, > pb=3Dpb@entry=3D0x1be06d2d06644) > at bufmgr.c:4137 > #1 0x0000000000801268 in med3 (a=3D0x7f6fa9ef4b2c "\177\006", > b=3D0x1be06d2d06644
, > c=3D0x2fc9dfbb1815c
, cmp=3D0x6a4= d20 > ) > at qsort.c:107 > #2 0x0000000000801621 in pg_qsort (a=3D0x7f6fa9ef4b2c, a@entry=3D0x7f6f= a9ea8380, > n=3D, es=3Des@entry=3D20, cmp=3Dcmp@entry=3D0x6a4d20 > ) at qsort.c:157 > #3 0x00000000008015e2 in pg_qsort (a=3D0x7f6fa9ea8380, n=3D, > n@entry=3D111473, es=3Des@entry=3D20, cmp=3Dcmp@entry=3D0x6a4d20 > ) at qsort.c:203 > #4 0x00000000006a81cf in BufferSync (flags=3Dflags@entry=3D128) at > bufmgr.c:1863 Hm. I'm not normally one to jump to the conclusion that something is a compiler bug, but it's hard to explain this stack trace any other way. The value of "n" passed to the inner invocation of pg_qsort should not have been more than 29914, but working from either the value of d or the value of pn leads to the conclusion that it was 0x7f6fa9f3a470, which looks a lot more like an address in the array than a proper value of n. I suppose this might be due to a corrupted copy of the postgres executable rather than an actual compiler bug. Did you build it yourself? BTW, I notice that ckpt_buforder_comparator assumes it can't possibly see the same block ID twice in the array, which I think is an unsupportable assumption. But I cannot see a way that that could lead to a crash in pg_qsort --- at worst it might cause a little inefficiency. regards, tom lane