Re: Fix a race condition in ConditionVariableTimedSleep()

Поиск
Список
Период
Сортировка
От Nazir Bilal Yavuz
Тема Re: Fix a race condition in ConditionVariableTimedSleep()
Дата
Msg-id CAN55FZ2GHPSAqC3c+tiYwTSyu-nbAsqdTjn_JVQHA9y1wLO=LA@mail.gmail.com
обсуждение исходный текст
Ответ на Fix a race condition in ConditionVariableTimedSleep()  (Bertrand Drouvot <bertranddrouvot.pg@gmail.com>)
Ответы Re: Fix a race condition in ConditionVariableTimedSleep()
Список pgsql-hackers
Hi,

Thanks for the report and the patch!

On Mon, 5 May 2025 at 10:53, Bertrand Drouvot
<bertranddrouvot.pg@gmail.com> wrote:
>
> The proposed fix attached is done in ConditionVariableTimedSleep() as this is the
> place that introduces the race condition. It re-assigns cv_sleep_target to cv
> and then ensures that cv_sleep_target accurately describes which condition
> variable we’re prepared to wait on.
>
> Looking forward to your feedback,

I am able to reproduce the race condition and confirm that the
proposed patch fixes the problem.

However AFAIU, the code expects that ConditionVariableCancelSleep()
should not be called while waiting for the latch, right? If that is
the case, does not the reproducer code violate this?

--
Regards,
Nazir Bilal Yavuz
Microsoft



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