From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Robert Haas <robertmhaas(at)gmail(dot)com> |
Cc: | Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, MauMau <maumau307(at)gmail(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: [bug fix] "pg_ctl stop" times out when it should respond quickly |
Date: | 2014-04-05 00:10:16 |
Message-ID: | 13314.1396656616@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> On Mon, Feb 17, 2014 at 11:29 AM, Alvaro Herrera
> <alvherre(at)2ndquadrant(dot)com> wrote:
>> The pg_regress part is ugly. However, pg_regress is doing something
>> unusual when starting postmaster itself, so the ugly coding to stop it
>> seems to match. If we wanted to avoid the ugliness here, the right fix
>> would be to use pg_ctl to start postmaster as well as to stop it.
> I wonder if this would change the behavior in cases where we hit ^C
> during the regression tests. Right now I think that kills the
> postmaster as well as pg_regress, but if we used pg_ctl, it might not,
> because pg_regress uses fork()+exec(), but pg_ctl uses system() to
> launch a shell which is in turn instructed to background the
> postmaster.
After re-reading this thread, I am convinced that this patch is failing
to fix the real problem, which is that the postmaster isn't defending
against early arrival of a signal; see
http://www.postgresql.org/message-id/30805.1386110129@sss.pgh.pa.us
Hacking pg_ctl is a band-aid solution, and given these concerns,
not a particularly safe band-aid.
I experimented with simply moving postmaster.c's initialization of signals
further up, and that seems to fix the complained-of problem just fine.
It could be an issue if anything in postmaster initialization is expecting
to run with signals unblocked, but I don't know what that would be.
So I suggest we just do the attached.
regards, tom lane
Attachment | Content-Type | Size |
---|---|---|
postmaster-block-signals-earlier.patch | text/x-diff | 3.2 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2014-04-05 00:35:23 | Re: [bug fix] pg_ctl fails with config-only directory |
Previous Message | Tom Lane | 2014-04-04 23:28:11 | Re: [bug fix] pg_ctl always uses the same event source |