Re: Issue with the PRNG used by Postgres

Поиск
Список
Период
Сортировка
От Alexander Lakhin
Тема Re: Issue with the PRNG used by Postgres
Дата
Msg-id 284660e9-e930-963d-71f6-ca693f04dac0@gmail.com
обсуждение исходный текст
Ответ на Re: Issue with the PRNG used by Postgres  (Alexander Lakhin <exclusion@gmail.com>)
Список pgsql-hackers
12.04.2024 08:05, Alexander Lakhin wrote:
> 2024-04-12 05:00:17.981 UTC [762336] PANIC:  stuck spinlock detected at WaitBufHdrUnlocked, bufmgr.c:5726
>

It looks like that spinlock issue caused by a race condition/deadlock.
What I see when the test fails is:
A client backend executing "DROP DATABASE conflict_db" performs
dropdb() -> DropDatabaseBuffers() -> InvalidateBuffer()
At the same time, bgwriter performs (for the same buffer):
BgBufferSync() -> SyncOneBuffer()

When InvalidateBuffer() is called, the buffer refcount is zero,
then bgwriter pins the buffer, thus increases refcount;
InvalidateBuffer() gets into the retry loop;
bgwriter calls UnpinBuffer() -> UnpinBufferNoOwner() ->
   WaitBufHdrUnlocked(), which waits for !BM_LOCKED state,
while InvalidateBuffer() waits for the buffer refcount decrease.

As it turns out, it's not related to spinlocks' specifics or PRNG, just a
serendipitous find.

Best regards,
Alexander



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: Issue with the PRNG used by Postgres
Следующее
От: Andres Freund
Дата:
Сообщение: Re: Security lessons from liblzma - libsystemd