Skip site navigation (1) Skip section navigation (2)

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: (view raw, whole thread or download thread mbox)
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



pgsql-patches by date

Next:From: Neil ConwayDate: 2004-05-27 19:11:07
Subject: Re: Cancel/Kill backend functions
Previous:From: Alvaro HerreraDate: 2004-05-27 18:30:33
Subject: Re: Cancel/Kill backend functions

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group