Re: Autovacuum launcher doesn't notice death of postmaster immediately

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Autovacuum launcher doesn't notice death of postmaster immediately
Date: 2007-06-04 15:04:26
Message-ID: 20070604150426.GI4779@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Peter Eisentraut wrote:
> I notice that in 8.3, when I kill the postmaster process with SIGKILL or
> SIGSEGV, the child processes writer and stats collector go away
> immediately, but the autovacuum launcher hangs around for up to a
> minute. (I suppose this has to do with the periodic wakeups?). When
> you try to restart the postmaster before that it fails with a complaint
> that someone is still attached to the shared memory segment.
>
> These are obviously not normal modes of operation, but I fear that this
> could cause some problems with people's control scripts of the
> sort, "it crashed, let's try to restart it".

The launcher is set up to wake up in autovacuum_naptime seconds at most.
So if the user configures a ridiculuos time (for example 86400 seconds,
which I've seen) then the launcher would not detect the postmaster death
for a very long time, which is probably bad. (You measured a one minute
delay because that's the default naptime).

Maybe this is not such a hot idea, and we should wake the launcher up
every 10 seconds (or less?). I picked 10 seconds because that's the
time the bgwriter sleeps if there is no activity configured. Does this
sound acceptable? The only problem with waking it up too frequently is
that it would be waking the system up (for gettimeofday()) even if
nothing is happening.

I also just noticed that the launcher will check if postmaster is alive,
then sleep, and then possibly do some work. So if the postmaster died
in the sleep period, the launcher might try to do some work. Should we
add a check for postmaster liveliness after the sleep?

--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2007-06-04 15:18:53 Re: Running all tests by default
Previous Message Michael Meskes 2007-06-04 14:50:17 Re: So, why isn't *every* buildfarm member failing ecpg right now?

Browse pgsql-patches by date

  From Date Subject
Next Message Tom Lane 2007-06-04 15:16:41 Re: Synchronized scans
Previous Message Bruce Momjian 2007-06-04 14:56:49 Re: Synchronized scans