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>
Cc: 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: Wed, 07 May 2014 02:25:40 +0200
Message-ID: <53697D84.1050103@2ndquadrant.com> (raw)
In-Reply-To: <CA+TgmoZyW_xVDyew0pNVTe43VbNhPMp2kGi+kcw+f7fM-GXy7w@mail.gmail.com>
References: <20140416131052.GG17874@awork2.anarazel.de>
	<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>
	<535EB7CB.3020807@2ndquadrant.com>
	<CA+Tgmob4Ur9b4opDJXVBpDSNSGpp5V-zG2V4Vt7RdTLT-ZAuLQ@mail.gmail.com>
	<5366474D.4060408@2ndquadrant.com>
	<CA+TgmoZyW_xVDyew0pNVTe43VbNhPMp2kGi+kcw+f7fM-GXy7w@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>

On 06/05/14 19:05, Robert Haas wrote:
> Which brings up another point: the behavior of non-shmem-connected
> workers is totally bizarre.  An exit status other than 0 or 1 is not
> treated as a crash requiring a restart, but failure to disengage the
> deadman switch is still treated as a crash requiring a restart.  Why?
> If the workers are not shmem-connected, then no crash requires a
> system-wide restart.  Of course, there's the tiny problem that we
> aren't actually unmapping shared memory from supposedly non-shmem
> connected workers, which is a different bug, but ignoring that for the
> moment there's no reason for this logic to be like this.

Agreed.

> What I'm inclined to do is change the logic so that:
>
> (1) After a crash-and-restart sequence, zero rw->rw_crashed_at, so
> that anything which is still registered gets restarted immediately.

Yes, that's quite obvious change which I missed completely :).

> (2) If a shmem-connected backend fails to release the deadman switch
> or exits with an exit code other than 0 or 1, we crash-and-restart.  A
> non-shmem-connected backend never causes a crash-and-restart.

+1

> (3) When a background worker exits without triggering a
> crash-and-restart, an exit code of precisely 0 causes the worker to be
> unregistered; any other exit code has no special effect, so
> bgw_restart_time controls.

+1


-- 
  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



view thread (36+ messages)  latest in thread

Message-ID: <53697D84.1050103@2ndquadrant.com>
Permalink:  ../53697D84.1050103@2ndquadrant.com/
Also on:    postgresql.org/message-id/53697D84.1050103@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: <53697D84.1050103@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