Re: Function to kill backend

From: "Dann Corbit" <DCorbit(at)connx(dot)com>
To: "Magnus Hagander" <mha(at)sollentuna(dot)net>, "Andrew Dunstan" <andrew(at)dunslane(dot)net>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Function to kill backend
Date: 2004-04-02 22:47:03
Message-ID: D90A5A6C612A39408103E6ECDD77B8299CA998@voyager.corporate.connx.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> -----Original Message-----
> From: Magnus Hagander [mailto:mha(at)sollentuna(dot)net]
> Sent: Friday, April 02, 2004 2:34 PM
> To: Andrew Dunstan; pgsql-hackers(at)postgresql(dot)org
> Subject: Re: [HACKERS] Function to kill backend
>
>
> >>Hi!
> >>
> >>When debugging on win32, I've created myself a little
> function that I
> >>feel should be added to the "backend proper". While it adds
> a lot of
> >>vlaue on win32, I think it adds quite a bit of value on non-win32
> >>platforms as well...
> >>
> >>The function is pg_kill_backend(<pid>,<signal>). superuser-only, of
> >>course. Which simply sends a signal to the specified backend -
> >>querycancel, terminate, etc.
> >>
> >>
> >
> >If' we're going to have this shouldn't it be a proper command?
> >And maybe
> >an internal shutdown command to go with it?
>
> I guess it could be. I guess:
>
> 1) I don't know how to do one of those ;-) Which is why I
> didn't even think it.
>
> 2) Won't that clutter up the namespace more, by introducing
> more keywords that you can't use for other things?
>
> 3) Will it still be possible to do the kind of things Rod
> mentioned, e.g. SELECT pg_kill_backend(procpid, 'TERM') FROM
> pg_stat_activity WHERE current_query LIKE '<IDLE>%'; ?

Sybase had something like that:

Syb_kill <pid> to kill a dangling process.

And the undocumented:

Syb_terminate <pid>
to absolutely, positively kill it (Syb_kill only worked sometimes).

In general, I think this approach is a bit worrisome. It reminds one of
the famous tagline:

"Tip: Don't kill -9 the postmaster."

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2004-04-02 23:06:12 Re: [GENERAL] Large DB
Previous Message Magnus Hagander 2004-04-02 22:33:32 Re: Function to kill backend