Re: [bug fix] "pg_ctl stop" times out when it should respond quickly

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: MauMau <maumau307(at)gmail(dot)com>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [bug fix] "pg_ctl stop" times out when it should respond quickly
Date: 2014-02-17 16:29:00
Message-ID: 20140217162859.GP6342@eldon.alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

MauMau escribió:

> pg_ctl timed out waiting for the zombie postgres.
>
> maumau 19621 18849 0 15:21 pts/9 00:00:00 [postgres] <defunct>
> maumau 20253 18849 0 15:22 pts/9 00:00:00 /maumau/postgresql-9.4/src/test/regress/./tmp_check/install//maumau/pgsql/bin/pg_ctl
> stop -D /maumau/postgresql-9.4/src/test/regress/./tmp_check/data -s
> -m fast
>
> pg_regress must wait for postgres to terminate by calling waitpid(),
> because it invoked postgres directly. The attached
> pg_regress_pg_stop.patch does this. If you like the combination of
> this and the original fix for pg_ctl in one patch, please use
> pg_stop_fail_v3.patch.

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. But
that'd come at a price, because we would need more ugly code to figure
out postmaster's PID. All in all, the compromise proposed by this patch
seems acceptable. If we really wanted to make all this real pretty, we
could provide a "libpg_ctl" library to start and stop postmaster, as
well as query the PID. Probably not worth the trouble.

I would apply this patch to all supported branches after this week's
release.

--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2014-02-17 16:31:56 Re: Auto-tuning work_mem and maintenance_work_mem
Previous Message Andres Freund 2014-02-17 16:19:03 Re: Auto-tuning work_mem and maintenance_work_mem