Re: Is this a bug in auto vacuum worker?

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: CNG L <congnanluo(at)gmail(dot)com>
Cc: "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: Is this a bug in auto vacuum worker?
Date: 2019-01-09 04:50:17
Message-ID: 20190109045017.GI21835@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Tue, Jan 08, 2019 at 10:47:01AM -0800, CNG L wrote:
> In AutoVacWorkerMain(), the code calls on_shmem_exit(FreeWorkInfo,0) and
> then kill() to send SIGUSR2 to autovacuum launcher process. In
> FreeWorkInfo() it sets AutoVacuumShmem->av_signal[AutoVacRebalance] = true.
> But, is it possible that when autovacuum launcher’s SIGUSR2 handler checks
> av_signal[AutoVacRebalance], FreeWorkInfo() haven’t set this flag yet and
> thus autovacuum launcher will miss the AutoVacRebalance event?

No, I don't think so. There are a couple of instructions between the
moment SIGUSR2 is sent from the worker to the launcher for rebalancing
and the moment where on_shmem_exit() callbacks are called, still the
launcher gets aware of the death of the worker in ProcKill, so the
order of the events is right (double-checked manually as well):
1) Send SIGUSR2 from the worker to the launcher, asking for
rebalancing.
2) shmem callback is called.
3) launcher noticies the death of the worker, sees the signal, and
triggers the rebalancing.
--
Michael

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Masahiko Sawada 2019-01-09 07:00:51 Re: Is temporary functions feature official/supported? Found some issues with it.
Previous Message Michael Paquier 2019-01-09 04:27:47 Re: BUG #15576: Missing X509_get_signature_nid symbol causes the standby to fail to start stream replication