From: | Bruce Momjian <bruce(at)momjian(dot)us> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Alvaro Herrera <alvherre(at)commandprompt(dot)com>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: pg_terminate_backend() issues |
Date: | 2008-04-16 04:09:43 |
Message-ID: | 200804160409.m3G49h104438@momjian.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers pgsql-hackers |
Tom Lane wrote:
> Bruce Momjian <bruce(at)momjian(dot)us> writes:
> > Tom Lane wrote:
> >> I was able to get things to more or less work most of the time with
> >> three or four additional ugly hacks in postgres.c, but I still don't
> >> have any great confidence that there aren't windows where a terminate
> >> request wouldn't be ignored (even without considering the uncooperative-
> >> function scenario). Moreover it's entirely unclear that this approach
> >> actually dodges any of the hypothetical bugs in SIGTERM handling.
>
> > I don't understand. If we call proc_exit(0) instead, it is the same as
> > someone exiting the backend via PQfinish().
>
> Well, using proc_exit() instead of die() might have alleviated that
> particular objection, but there are still the others.
Tom, thanks for you feedback. It was very helpful.
I have adjusted the patch to return a locked PGPROC entry, initialize
the PGPROC->terminate boolean, called proc_exit(), and moved the
PGPROC->terminate test out of the cancel loop entirely so lost cancel
signals are not as big a problem anymore.
I agree it would be best for pg_terminate_backend() and for the
postmaster use of SIGTERM if SIGTERM was more reliable about cleanup, so
hopefully that will work for 8.4. I have attached my patch in hopes we
can use it as a backup in case we can't get SIGTERM to work for
individual backends for 8.4.
[ I have posted about testing in a separate email.]
--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ If your life is a hard drive, Christ can be your backup. +
Attachment | Content-Type | Size |
---|---|---|
unknown_filename | text/plain | 13.5 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2008-04-16 04:54:31 | Re: pg_terminate_backend() issues |
Previous Message | Bruce Momjian | 2008-04-16 03:58:40 | Re: pg_terminate_backend() issues |
From | Date | Subject | |
---|---|---|---|
Next Message | ITAGAKI Takahiro | 2008-04-16 04:22:13 | Re: Sorting writes during checkpoint |
Previous Message | Bruce Momjian | 2008-04-16 03:58:40 | Re: pg_terminate_backend() issues |