Re: Race condition in WaitForBackgroundWorkerStartup

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: finzelj(at)gmail(dot)com
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Race condition in WaitForBackgroundWorkerStartup
Date: 2018-11-13 12:17:25
Message-ID: CAA4eK1+QeMn8AgXQo7fko9DMQT0kOdBS+RMCNg24BwJ+XBrwXw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Nov 12, 2018 at 11:55 PM Jeremy Finzel <finzelj(at)gmail(dot)com> wrote:
>
> I believe I found a race condition in WaitForBackgroundWorkerStartup in the case where it encounters an ERROR during startup. I found that depending on the speed of the system, it will unreliably return either status BGWH_STOPPED or BGWH_STARTED. But I can reliably reproduce getting BGWH_STOPPED by tweaking the worker_spi.c test module.
>

Yeah, I think it is possible that you get different values in such
cases because we consider worker status as started after we have
launched the worker. Now, if we get the error in the worker
initialization, then the user can get any of those values. I think
this is what is happening in your case where you are saying "ERROR
during startup".
Am I missing something?

--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jürgen Strobel 2018-11-13 12:44:03 Re: BUG #15212: Default values in partition tables don't work as expected and allow NOT NULL violation
Previous Message legrand legrand 2018-11-13 12:12:19 Re: proposal: simple query profile and tracing API