Re: bgwriter never dies

From: Jan Wieck <JanWieck(at)Yahoo(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: bgwriter never dies
Date: 2004-02-24 03:42:50
Message-ID: 403AC83A.9080008@Yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> I noticed while doing some debugging this morning that if the postmaster
> crashes for some reason (eg kill -9) the bgwriter process never goes
> away. Backends will eventually exit when their clients quit, and the
> stats collection processes shut down nicely, but the bgwriter process
> has to be killed by hand. This doesn't seem like a real good thing.
> Maybe there should be a provision similar to the stats collector's
> check-for-read-ready-from-a-pipe?

Hmmmm,

the case of the bgwriter is a bit of a twist here. In contrast to the
collectors it is connected to the shared memory. So it can keep
resources and also even worse, it could write() after the postmaster died.

Maybe there is a chance to create a watchdog for free here. Do we
currently create our own process group, with all processes under the
postmaster belonging to it? If the bgwriter would at the times it naps
check if its parent process is init, (Win32 note, check if the
postmaster does not exist any more instead), it could kill the entire
process group on behalf of the dead postmaster. This is one more system
call at a time, where the bgwriter does a system call with a timeout to
nap anyway.

Jan

--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck(at)Yahoo(dot)com #

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Christopher Kings-Lynne 2004-02-24 04:17:20 user defined function in CHECK constraint
Previous Message Tom Lane 2004-02-24 03:41:26 Re: client_encoding in dump file