Re: elog(FATAL) vs shared memory

From: Stuart Bishop <stuart(dot)bishop(at)canonical(dot)com>
To: Mark Shuttleworth <mark(at)ubuntu(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgreSQL(dot)org, Martin Pitt <martin(dot)pitt(at)ubuntu(dot)com>
Subject: Re: elog(FATAL) vs shared memory
Date: 2007-04-05 10:23:09
Message-ID: 4614CE0D.7050405@canonical.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Mark Shuttleworth wrote:
> Tom Lane wrote:
>> (1) something (still not sure what --- Martin and Mark, I'd really like
>> to know) was issuing random SIGTERMs to various postgres processes
>> including autovacuum.
>>
>
> This may be a misfeature in our test harness - I'll ask Stuart Bishop to
> comment.

After a test is run, the test harness kills any outstanding connections so
we can drop the test database. Without this, a failing test could leave open
connections dangling causing the drop database to block.

CREATE OR REPLACE FUNCTION _killall_backends(text)
RETURNS Boolean AS $$
import os
from signal import SIGTERM

plan = plpy.prepare(
"SELECT procpid FROM pg_stat_activity WHERE datname=$1", ['text']
)
success = True
for row in plpy.execute(plan, args):
try:
plpy.info("Killing %d" % row['procpid'])
os.kill(row['procpid'], SIGTERM)
except OSError:
success = False

return success
$$ LANGUAGE plpythonu;

--
Stuart Bishop <stuart(dot)bishop(at)canonical(dot)com> http://www.canonical.com/
Canonical Ltd. http://www.ubuntu.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2007-04-05 10:46:39 Fix mdsync never-ending loop problem
Previous Message Albe Laurenz 2007-04-05 09:52:14 Re: Bug in UTF8-Validation Code?