| From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
|---|---|
| To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
| Cc: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: Instability in select_parallel regression test |
| Date: | 2017-02-19 12:35:53 |
| Message-ID: | CA+TgmoZifsRFwP2Aby6yL9sj+oxML53mAfccV-7CqTGvmiEVHQ@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Sun, Feb 19, 2017 at 5:54 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> However, it looks like there's a race condition here, because the slot
> doesn't get freed up at the same time that the PID gets set to 0.
> That actually happens later, when the postmaster calls
> maybe_start_bgworker() or DetermineSleepTime() and one of those
> functions calls ForgetBackgroundWorker(). We could tighten this up by
> changing CleanupBackgroundWorker() to also call
> ForgetBackgroundWorker() immediately after calling
> ReportBackgroundWorker() if rw->rw_terminate ||
> rw->rw_worker.bgw_restart_time == BGW_NEVER_RESTART. If we do that
> BEFORE sending the notification to the starting process, that closes
> this hole. Almost.
And here's a patch implementing something along those lines.
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
| Attachment | Content-Type | Size |
|---|---|---|
| forget-workers-faster.patch | application/octet-stream | 2.9 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Michael Paquier | 2017-02-19 12:43:14 | Re: Provide list of subscriptions and publications in psql's completion |
| Previous Message | Magnus Hagander | 2017-02-19 12:33:20 | Re: Provide list of subscriptions and publications in psql's completion |