ERROR: invalid spinlock number: 0 - Mailing list pgsql-hackers

From Fujii Masao
Subject ERROR: invalid spinlock number: 0
Date
Msg-id 7ef8708c-5b6b-edd3-2cf2-7783f1c7c175@oss.nttdata.com
Whole thread Raw
Responses Re: ERROR: invalid spinlock number: 0
List pgsql-hackers
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



pgsql-hackers by date:

Previous
From: Kazutaka Onishi
Date:
Subject: Re: TRUNCATE on foreign table
Next
From: Erik Rijkers
Date:
Subject: Re: Routine usage information schema tables