Re: pg_terminate_backend for same-role - Mailing list pgsql-hackers

From Fujii Masao
Subject Re: pg_terminate_backend for same-role
Date
Msg-id CAHGQGwEFU7mdoyBDPJ-zNo2cX4VMXqXVxDVdkOLZozJmpE2zPg@mail.gmail.com
Whole thread Raw
In response to pg_terminate_backend for same-role  (Daniel Farina <daniel@heroku.com>)
Responses Re: pg_terminate_backend for same-role  (Daniel Farina <daniel@heroku.com>)
Re: pg_terminate_backend for same-role  (Daniel Farina <daniel@heroku.com>)
List pgsql-hackers
On Fri, Mar 16, 2012 at 8:14 AM, Daniel Farina <daniel@heroku.com> wrote:
> Parallel to pg_cancel_backend, it'd be nice to allow the user to just
> outright kill a backend that they own (politely, with a SIGTERM),
> aborting any transactions in progress, including the idle transaction,
> and closing the socket.

+1

> I imagine the problem is a race condition whereby a pid might be
> reused by another process owned by another user (doesn't that also
> affect pg_cancel_backend?).

Yes, but I think it's too unlikely to happen. Not sure if we really
should worry about that.

> Shall we just do everything using the
> MyCancelKey (which I think could just be called "SessionKey",
> "SessionSecret", or even just "Session") as to ensure we have no case
> of mistaken identity? Or does that end up being problematic?

What if pid is unfortunately reused after passing the test of MyCancelKey
and before sending the signal?

Regards,

-- 
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: patch for parallel pg_dump
Next
From: Daniel Farina
Date:
Subject: Re: pg_terminate_backend for same-role