From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Mike Mascari <mascarm(at)mascari(dot)com> |
Cc: | "Johnson, Shaunn" <SJohnson6(at)bcbsm(dot)com>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: how to terminate a process when kill fails |
Date: | 2002-11-02 01:15:36 |
Message-ID: | 200211020115.gA21Fav22771@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Woh, the prohibition to using kill -9 is still valid. I can think of no
reason to use -9 unless something is broken in our code or in the OS.
pg_ctl code has:
case "$shutdown_mode" in
s|smart)
sig="-TERM"
;;
f|fast)
sig="-INT"
;;
i|immediate)
sig="-QUIT"
;;
and the 7.3 postgres manual page has:
To stop a running query use the SIGINT signal. To
tell postgres to reread the config file,
use a SIGHUP signal. The postmaster uses SIGTERM
to tell a postgres process to quit normally and
SIGQUIT to terminate without the normal cleanup.
These should not be used by users.
---------------------------------------------------------------------------
Mike Mascari wrote:
> Johnson, Shaunn wrote:
> >
> > Running PostgreSQL 7.2.1 on RedHat Linux 7.2.
> >
> > I think I may have asked before, but I never got an answer
> > that told me one way or another -
> >
> > How can I kill processes without kill -9 <pid> and
> > ruining the database?
> >
> > I've tried restarting postgreSQL hoping that it cleans up
> > a few things. I've tried to simply kill the processes that
> > were running. Nothing happens; nothing dies. I don't see
> > much of anything in the messages / log files.
> >
> > Any suggestions?
>
> Use kill -9. Do a:
>
> killall -9 postgres
> killall -9 postmaster
>
> The tip message
>
> 'Don't kill -9 the postmaster'
>
> is old and was added when havoc could be caused by an old
> postgres backend process. Consider the scenrio:
>
> 1. postmaster started
> 2. postgres started (Session #1)
> 3. postmaster killed (-9)
> 4. postmaster restarted
> 5. postgres started (Session #2)
>
> Now there isn't any synchronization between Sesison #1 and
> Session #2 at all, which would lead to data corruption. This
> scenario was fixed a long time ago (7.1?). The whole 'Don't kill
> -9 the postmaster' comment was actually a tongue-in-cheek remark
> by me regarding a parallel discussion of RedHat init scripts.
> The corruption possibility has long-since been fixed. Since I've
> seen FUD claiming PostgreSQL doesn't have sufficient
> crash-recovery because of the tip, I suggest the tip be changed to:
>
> 'Feel free to kill -9 the postmaster'
>
> Mike Mascari
> mascarm(at)mascari(dot)com
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
>
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2002-11-02 01:22:56 | Re: [SQL] unnecessary updates |
Previous Message | Tom Lane | 2002-11-02 00:28:16 | Re: problems with building recent cvs snaphots |