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 1iUZXA-0004z6-D4 for pgsql-hackers@arkaria.postgresql.org; Tue, 12 Nov 2019 17:00:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iUZX8-000396-Kn for pgsql-hackers@arkaria.postgresql.org; Tue, 12 Nov 2019 17:00:50 +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 1iUZX8-00038v-Ar for pgsql-hackers@lists.postgresql.org; Tue, 12 Nov 2019 17:00:50 +0000 Received: from [212.85.157.172] (helo=mail.dalibo.com) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iUZX6-0003pG-47 for pgsql-hackers@lists.postgresql.org; Tue, 12 Nov 2019 17:00:49 +0000 Received: from firost (unknown [88.190.0.6]) by mail.dalibo.com (Postfix) with ESMTPSA id 4D1811F9DC; Tue, 12 Nov 2019 18:00:44 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=dalibo.com; s=a; t=1573578044; bh=QmpTpPDXSt/gJ2QhfXh89bMm1+g0UrmqHVKz1DIyqRo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=RJeBcdD2jmu2zhH8qcwPYfIc6pABBZCt2FlJPi3Zpc3r3GBSnrvWUGL89n2nyCW0l iOa7uo3arq/AMee00A6TFYB/ACx3VWJ2v3NPtc0PuqEo4gvhOG7twHoMfj4k+qy6Up eNfXYCgqJREuf9ee32AwjFr43FaNSryxHsu91XyU= Date: Tue, 12 Nov 2019 18:00:43 +0100 From: Jehan-Guillaume de Rorthais To: Kyotaro Horiguchi Cc: tgl@sss.pgh.pa.us, pgsql-hackers@lists.postgresql.org Subject: Re: segmentation fault when cassert enabled Message-ID: <20191112180043.6ee7d1b6@firost> In-Reply-To: <20191028.164702.1704313690000434195.horikyota.ntt@gmail.com> References: <20191025175929.7e90dbf5@firost> <18714.1572020918@sss.pgh.pa.us> <20191028.164702.1704313690000434195.horikyota.ntt@gmail.com> Organization: Dalibo MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 212.85.157.172 (failed) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Mon, 28 Oct 2019 16:47:02 +0900 (JST) Kyotaro Horiguchi wrote: > At Fri, 25 Oct 2019 12:28:38 -0400, Tom Lane wrote in > > Jehan-Guillaume de Rorthais writes: > > > When investigating for the bug reported in thread "logical replication - > > > negative bitmapset member not allowed", I found a way to seg fault > > > postgresql only when cassert is enabled. > > > ... > > > I hadn't time to digg further yet. However, I don't understand why this > > > crash is triggered when cassert is enabled. > > > > Most likely, it's not so much assertions that provoke the crash as > > CLOBBER_FREED_MEMORY, ie the actual problem here is use of already-freed > > memory. > > Agreed. > > By the way I didn't get a crash by Jehan's script with the > --enable-cassert build of the master HEAD of a few days ago. I am now working with HEAD and I can confirm I am able to make it crash 99% of the time using my script. It feels like a race condition between cache invalidation and record processing from worker.c. Make sure you have enough write activity during the test. > FWIW I sometimes got SEGVish crashes or mysterious misbehavor when > some structs were changed and I didn't do "make clean". Rarely I > needed "make distclean". (Yeah, I didn't ususally turn on > --enable-depend..) I'm paranoid, I always do: * make distclean * git reset; git clean -df * ./configure && make install Regards,