Re: sinval synchronization considered harmful

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: sinval synchronization considered harmful
Дата
Msg-id 13077.1311702188@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: sinval synchronization considered harmful  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: sinval synchronization considered harmful
Список pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
> On further reflection, I don't see that this helps: it just moves the
> problem around.  With resetState as a separate variable, nextMsgNum is
> never changed by anyone other than the owner, so we can never have a
> stale load.  But if we overload nextMsgNum to also indicate whether
> our state has been reset, then there's a race between when we load
> nextMsgNum and when we load maxMsgNum (instead of code I posted
> previously, which has a race between when we load resetState and when
> we load maxMsgNum).  Now, as you say, it seems really, really
> difficult to hit that in practice, but I don't see a way of getting
> rid of the theoretical possibility without either (1) a spinlock or
> (2) a fence.  (Of course, on x86, the fence could be optimized down to
> a compiler barrier.)  I guess the question is "should we worry about
> that?".

Uh, yes.  I've lost count of the number of times I've seen people hit
one-instruction-wide race condition windows, SIGSEGV crash based on
accessing only one byte past the valid data structure, etc etc.
The worst thing about this type of bug is that you can't reproduce the
failure when you try; doesn't mean your users won't see it.
        regards, tom lane


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

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: sinval synchronization considered harmful
Следующее
От: pasman pasmański
Дата:
Сообщение: Re: problem with compiling beta3 on mingw32+WinXP