Re: Unexpected "shared memory block is still in use"

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Unexpected "shared memory block is still in use"
Дата
Msg-id 2226.1557439179@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Unexpected "shared memory block is still in use"  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Unexpected "shared memory block is still in use"  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
I wrote:
> Noah Misch <noah@leadboat.com> writes:
>> The odds are very high that you would not have gotten that error before that
>> commit.  But if the cause matches your guess, it's not something wrong with
>> the commit ...

> Fair point.

After more study and testing, I no longer believe my original thought
about a bootstrap-to-standalone-backend race condition.  The bootstrap
process definitely kills its SysV shmem segment before exiting.

However, I have a new theory, after noticing that c09850992 moved the
check for shm_nattch == 0.  Previously, if a shmem segment had zero attach
count, it was unconditionally considered not-a-threat.  Now, we'll try
shmat() anyway, and if that fails for any reason other than EACCES, we say
SHMSTATE_ANALYSIS_FAILURE which leads to the described error report.
So I suspect that what we hit was a race condition whereby some other
parallel test was using the same shmem ID and we managed to see its
segment successfully in shmctl but then it was gone by the time we did
shmat.  This leads me to think that EINVAL and EIDRM failures from
shmat had better be considered SHMSTATE_ENOENT not
SHMSTATE_ANALYSIS_FAILURE.

In principle this is a longstanding race condition, but I wonder
whether we made it more probable by moving the shm_nattch check.

            regards, tom lane



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

Предыдущее
От: Thomas Munro
Дата:
Сообщение: Re: pg12 release notes
Следующее
От: Peter Geoghegan
Дата:
Сообщение: Re: _bt_split(), and the risk of OOM before its critical section