Re: [BUGS] BUG #3242: FATAL: could not unlock semaphore: error code 298

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [BUGS] BUG #3242: FATAL: could not unlock semaphore: error code 298
Дата
Msg-id 7149.1177088100@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [BUGS] BUG #3242: FATAL: could not unlock semaphore: error code 298  (Magnus Hagander <magnus@hagander.net>)
Ответы Re: [BUGS] BUG #3242: FATAL: could not unlock semaphore: error code 298  (Magnus Hagander <magnus@hagander.net>)
Список pgsql-hackers
Magnus Hagander <magnus@hagander.net> writes:
> Tom Lane wrote:
>> How is it possible for a semaphore to be unlocked "too many times"?
>> It's supposed to be a running counter of the net V's minus P's, and
>> yes it had better be able to count higher than one.  Have we chosen
>> the wrong Windows primitive to implement this?

> No, it's definitly the right primitive. But we're creating it with a max
> count of 1.

That's definitely wrong.  There are at least three reasons for a PG
process's semaphore to be signaled (heavyweight lock release, LWLock
release, pin count waiter), and at least two of them can occur
concurrently (eg, if deadlock checker fires, it will need to take
LWLocks, but there's nothing saying that the original lock won't be
released while it waits for an LWLock).

The effective max count on Unixen is typically in the thousands,
and I'd suggest the same on Windows unless there's some efficiency
reason to keep it small (in which case, maybe ten would do).

I'm astonished that we've not seen this reported before.  Has the
Windows sema code always been like that?
        regards, tom lane


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

Предыдущее
От: Magnus Hagander
Дата:
Сообщение: Re: [BUGS] BUG #3242: FATAL: could not unlock semaphore: error code 298
Следующее
От: Magnus Hagander
Дата:
Сообщение: Re: [BUGS] BUG #3242: FATAL: could not unlock semaphore: error code 298