Re: Cancel/Kill backend functions

From: "Magnus Hagander" <mha(at)sollentuna(dot)net>
To: "Alvaro Herrera" <alvherre(at)dcc(dot)uchile(dot)cl>
Cc: "Bruce Momjian" <pgman(at)candle(dot)pha(dot)pa(dot)us>, "Neil Conway" <neilc(at)samurai(dot)com>, <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Cancel/Kill backend functions
Date: 2004-05-27 18:35:28
Message-ID: 6BCB9D8A16AC4241919521715F4D8BCE34BB4B@algol.sollentuna.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

>> >> Okay, here is an updated patch. now uses IsBackendPid(), which is
>> >> closely modeled (read cut-and-pasted) from
>> >> TransactionIdIsInProgress().
>
>I wonder what can happen if a backend passes the
>IsBackendPid() test and
>terminates just before the kill() signal? It should be pretty unlikely
>but you could signal the wrong process ... shouldn't the SInvalLock be
>held throughout the whole operation?

You'd actually need to get a pid *reuse* during that short time.
Otherwise, you're just kill():ing a nonexistant process, which should be
no problem.

This is the same as issuing a "kill -INT <pid>" from the shell after
doing ps(1), which is basically what this function tries to emulate.
Should be no more dangerous than that.

Bottom line - while maybe slightly more correcet, not sure it's
necessary.

//Magnus

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Neil Conway 2004-05-27 19:11:07 Re: Cancel/Kill backend functions
Previous Message Alvaro Herrera 2004-05-27 18:30:33 Re: Cancel/Kill backend functions