Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Wes1Y-00080Y-0I for pgsql-hackers@arkaria.postgresql.org; Mon, 28 Apr 2014 20:19:36 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Wes1X-0003iy-8x for pgsql-hackers@arkaria.postgresql.org; Mon, 28 Apr 2014 20:19:35 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Wes1V-0003ip-Fg for pgsql-hackers@postgresql.org; Mon, 28 Apr 2014 20:19:33 +0000 Received: from mout.kundenserver.de ([212.227.17.13]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Wes1S-0002lJ-VN for pgsql-hackers@postgresql.org; Mon, 28 Apr 2014 20:19:32 +0000 Received: from [192.168.42.222] ([195.166.117.126]) by mrelayeu.kundenserver.de (node=mreue105) with ESMTP (Nemesis) id 0LtFzX-1X2hAl17Jz-012sdx; Mon, 28 Apr 2014 22:19:25 +0200 Message-ID: <535EB7CB.3020807@2ndquadrant.com> Date: Mon, 28 Apr 2014 22:19:23 +0200 From: Petr Jelinek User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: Robert Haas , Craig Ringer CC: Andres Freund , Tom Lane , Antonin Houska , "pgsql-hackers@postgresql.org" , Abhijit Menon-Sen Subject: Re: bgworker crashed or not? References: <20140416131052.GG17874@awork2.anarazel.de> <20140416152803.GJ17874@awork2.anarazel.de> <20140416154412.GL17874@awork2.anarazel.de> <27214.1397663665@sss.pgh.pa.us> <20140416160047.GM17874@awork2.anarazel.de> <20140416161143.GN17874@awork2.anarazel.de> <20140416162837.GO17874@awork2.anarazel.de> <534EEC61.7000006@2ndquadrant.com> <534F21E6.7080705@2ndquadrant.com> <5358A38F.50808@2ndquadrant.com> In-Reply-To: Content-Type: multipart/mixed; boundary="------------000001050105050703080301" X-Provags-ID: V02:K0:qC7pvB6vnAr/ScFS45ccXIDwsoD+nK6zo97+v6kMy5g bpikY0WdLvNBE6hY0z47M86RpFOWJYJhynhkhgxGi0kHxijcQ9 yUgQQ7sCLMX2U40xQM4zKCyZWFzOvO6900/JAoO3jxjZaD8SCY JfsU7RGh2+ypO1ZMVv8aKqMKSqj0P3tz1SU+38+fPaPHxoryGB ZSkXV1+Z0i5BFfZF6PyUrCHEY5TZCtXYBFLI080rTua30t3sQY yAv1JKA48+XFh2+EZaC854BLxJBBky2aVYN9cQ8GxdyqZdrcY8 t0GRdnfHucXdyOUZmqeNrJKFDS28SIHJi2ajYSjaYcHD6Ty7Hc k/UcOIxCgvx4w1kMc5vTyHhV5CzRYi24ovVhTZEX9 X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org This is a multi-part message in MIME format. --------------000001050105050703080301 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 28/04/14 16:27, Robert Haas wrote: > On Thu, Apr 24, 2014 at 1:39 AM, Craig Ringer wrote: >> On 04/17/2014 08:35 AM, Craig Ringer wrote: >> I've just noticed that the bgworker control interfaces do not honour >> bgw.bgw_restart_time = BGW_NEVER_RESTART if you exit with status zero. >> >> This means that it's not simply a problem where you can't say "restart >> me if I crash, but not if I exit normally". >> >> You also can't even say "never restart me at all". Because >> "BGW_NEVER_RESTART" seems to really mean "BGW_NO_RESTART_ON_CRASH". >> >> This _needs_fixing before 9.4. > > It seems we have consensus on what to do about this, but what we > haven't got is a patch. > If you mean the consensus that exit status 0 should mean permanent stop then I think the patch can be as simple as attached. -- Petr Jelinek http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services --------------000001050105050703080301 Content-Type: text/x-patch; name="unregister-bgworker-on-exit0.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="unregister-bgworker-on-exit0.diff" diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c index b573fd8..be211f0 100644 --- a/src/backend/postmaster/postmaster.c +++ b/src/backend/postmaster/postmaster.c @@ -2848,7 +2848,10 @@ CleanupBackgroundWorker(int pid, if (!EXIT_STATUS_0(exitstatus)) rw->rw_crashed_at = GetCurrentTimestamp(); else + { rw->rw_crashed_at = 0; + rw->rw_terminate = true; + } /* * Additionally, for shared-memory-connected workers, just like a --------------000001050105050703080301 Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers --------------000001050105050703080301--