pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Petr Jelinek <petr@2ndquadrant.com>
To: Robert Haas <robertmhaas@gmail.com>
To: Craig Ringer <craig@2ndquadrant.com>
Cc: Andres Freund <andres@2ndquadrant.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Antonin Houska <antonin.houska@gmail.com>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Cc: Abhijit Menon-Sen <ams@2ndquadrant.com>
Subject: Re: bgworker crashed or not?
Date: Mon, 28 Apr 2014 22:19:23 +0200
Message-ID: <535EB7CB.3020807@2ndquadrant.com> (raw)
In-Reply-To: <CA+TgmoY0FXMayR1HH+uD+hM8+CL5Xh8nf610Eps55oJSmsU5+A@mail.gmail.com>
References: <20140416131052.GG17874@awork2.anarazel.de>
	<CA+TgmoYy2oJL7t-rknyVENm=vnqTTtb=R-TDkMsrMrgbhQDiew@mail.gmail.com>
	<20140416152803.GJ17874@awork2.anarazel.de>
	<CA+TgmoZPrzktkbwYRgv2fbhBi2_ty9BEtV6Gk-SSrERROZUkvw@mail.gmail.com>
	<20140416154412.GL17874@awork2.anarazel.de>
	<27214.1397663665@sss.pgh.pa.us>
	<20140416160047.GM17874@awork2.anarazel.de>
	<CA+TgmoZe4zqRAX8rgpy9UWy=PE7=3B_1J34bTehEi25hCgr3kw@mail.gmail.com>
	<20140416161143.GN17874@awork2.anarazel.de>
	<CA+TgmoaefVEJeO7+D=VE35Aj2fkgZ3YVqWx8Svzd3v493iJSvg@mail.gmail.com>
	<20140416162837.GO17874@awork2.anarazel.de>
	<CA+TgmoZLwmkZ2O6T29qAb9EhO-9cyz4Rj9mjLQVkFe673CooWA@mail.gmail.com>
	<534EEC61.7000006@2ndquadrant.com>
	<534F21E6.7080705@2ndquadrant.com>
	<5358A38F.50808@2ndquadrant.com>
	<CA+TgmoY0FXMayR1HH+uD+hM8+CL5Xh8nf610Eps55oJSmsU5+A@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

On 28/04/14 16:27, Robert Haas wrote:
> On Thu, Apr 24, 2014 at 1:39 AM, Craig Ringer <craig@2ndquadrant.com> 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

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Attachments:

unregister-bgworker-on-exit0.diff (text/x-patch, 489B) download 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

view thread (36+ messages)  latest in thread

Message-ID: <535EB7CB.3020807@2ndquadrant.com>
Permalink:  ../535EB7CB.3020807@2ndquadrant.com/
Also on:    postgresql.org/message-id/535EB7CB.3020807@2ndquadrant.com

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: petr@2ndquadrant.com, robertmhaas@gmail.com, craig@2ndquadrant.com, andres@2ndquadrant.com, tgl@sss.pgh.pa.us, antonin.houska@gmail.com, ams@2ndquadrant.com
  Subject: Re: bgworker crashed or not?
  In-Reply-To: <535EB7CB.3020807@2ndquadrant.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox