Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kaGpv-00054D-Db for pgsql-committers@arkaria.postgresql.org; Wed, 04 Nov 2020 11:20:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kaGpu-0004fE-0l for pgsql-committers@arkaria.postgresql.org; Wed, 04 Nov 2020 11:20:18 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kaGpt-0004f7-Rf for pgsql-committers@lists.postgresql.org; Wed, 04 Nov 2020 11:20:17 +0000 Received: from oss.nttdata.com ([49.212.34.109]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kaGpq-0006tm-U6 for pgsql-committers@lists.postgresql.org; Wed, 04 Nov 2020 11:20:16 +0000 Received: from hnk.local (p1295030-ipngn4902funabasi.chiba.ocn.ne.jp [153.166.85.30]) by oss.nttdata.com (Postfix) with ESMTPSA id 7B65662405; Wed, 4 Nov 2020 20:20:10 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.102.3 at oss.nttdata.com Subject: Re: pgsql: Get rid of the dedicated latch for signaling the startup process To: Heikki Linnakangas , Fujii Masao , pgsql-committers@lists.postgresql.org References: <5c1f8a85-747c-7bf9-241e-dd467d8a3586@iki.fi> From: Fujii Masao Message-ID: Date: Wed, 4 Nov 2020 20:20:09 +0900 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <5c1f8a85-747c-7bf9-241e-dd467d8a3586@iki.fi> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2020/11/04 19:27, Heikki Linnakangas wrote: > On 04/11/2020 09:44, Fujii Masao wrote: >> Get rid of the dedicated latch for signaling the startup process. >> >> This commit gets rid of the dedicated latch for signaling the startup >> process in favor of using its procLatch,  since that comports better >> with possible generic signal handlers using that latch. >> >> Commit 1e53fe0e70 changed background processes so that they use standard >> SIGHUP handler. Like that, this commit also makes the startup process use >> standard SIGHUP handler to simplify the code. > > This seems to have made buildfarm member 'elver' to segfault. I've got a hunch that setting recoveryWakeupLatch to NULL, when WakeupRecovery() doesn't check for NULL, is not OK. It's surprising that we're only seeing this on 'elver', though. Thanks for the report! The latch is reset to NULL after ShutdownWalRcv(). So I thought that there are no processes setting the latch (i.e., walreceiver has already exited) after it's reset to NULL. But this is not true. There seem a window between ShutdownWalRcv() and the actual exit of walreceiver. If a signal is sent during that window, the segmentation fault would happen. This would be the reason why segv happened in some platforms, but not in others. I'm thinking to remove the following code to fix this issue. Thought? /* * We don't need the latch anymore. It's not strictly necessary to reset * it to NULL, but let's do it for the sake of tidiness. */ if (ArchiveRecoveryRequested) XLogCtl->recoveryWakeupLatch = NULL; Regards, -- Fujii Masao Advanced Computing Technology Center Research and Development Headquarters NTT DATA CORPORATION