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 1l9TpL-0004Mg-70 for pgsql-hackers@arkaria.postgresql.org; Tue, 09 Feb 2021 14:17:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1l9TpK-0004xI-5t for pgsql-hackers@arkaria.postgresql.org; Tue, 09 Feb 2021 14:17:14 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l9TpJ-0004xB-Vr for pgsql-hackers@lists.postgresql.org; Tue, 09 Feb 2021 14:17:13 +0000 Received: from oss.nttdata.com ([49.212.34.109]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1l9TpD-00083C-SZ for pgsql-hackers@postgresql.org; Tue, 09 Feb 2021 14:17:13 +0000 Received: from hnk.local (p18067-ipngn2801funabasi.chiba.ocn.ne.jp [153.212.145.67]) by oss.nttdata.com (Postfix) with ESMTPSA id 2168462853 for ; Tue, 9 Feb 2021 23:17:05 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.102.3 at oss.nttdata.com To: pgsql-hackers@postgresql.org From: Fujii Masao Subject: ERROR: invalid spinlock number: 0 Message-ID: <7ef8708c-5b6b-edd3-2cf2-7783f1c7c175@oss.nttdata.com> Date: Tue, 9 Feb 2021 23:17:04 +0900 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi, Commit 3b733fcd04 caused the buildfarm member "rorqual" to report the following error and fail the regression test. The cause of this issue is a bug in that commit. ERROR: invalid spinlock number: 0 But while investigating the issue, I found that this error could happen even in the current master (without commit 3b733fcd04). The error can be easily reproduced by reading pg_stat_wal_receiver view before walreceiver starts up, in the server built with --disable-atomics --disable-spinlocks. Furthermore if you try to read pg_stat_wal_receiver again, that gets stuck. This is not good. ISTM that the commit 2c8dd05d6c caused this issue. The commit changed pg_stat_get_wal_receiver() so that it reads "writtenUpto" by using pg_atomic_read_u64(). But since "writtenUpto" is initialized only when walreceiver starts up, reading "writtenUpto" before the startup of walreceiver can cause the error. Also pg_stat_get_wal_receiver() calls pg_atomic_read_u64() while a spinlock is being held. Maybe this may cause the process to get stuck in --disable-atomics case, I guess. Thought? Regards, -- Fujii Masao Advanced Computing Technology Center Research and Development Headquarters NTT DATA CORPORATION