pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Peter LaDow <petela@gocougs.wsu.edu>
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #9464: PANIC with 'failed to re-find shared lock object'
Date: Thu, 06 Mar 2014 23:18:16 -0500
Message-ID: <339.1394165896@sss.pgh.pa.us> (raw)
In-Reply-To: <CAN8Q1EcLbgeCNNXav49nOrA9uR-LYjRmonTtPrm90f6zrdn=+g@mail.gmail.com>
References: <20140307005623.1918.22473@wrigleys.postgresql.org>
	<31620.1394163148@sss.pgh.pa.us>
	<CAN8Q1EcLbgeCNNXav49nOrA9uR-LYjRmonTtPrm90f6zrdn=+g@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

Peter LaDow <petela@gocougs.wsu.edu> writes:
> On Thu, Mar 6, 2014 at 7:32 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> on_exit_reset() in the first-level child would likely be a good idea.

> Thanks for the tip!  I tried it, and things are happy again.

Hah, thanks for confirming the diagnosis.

>> See atexit_callback in src/backend/storage/ipc/ipc.c: your first-level
>> child is killing all the parent backend's shared-memory state when it
>> does exit().  This is a safety feature we added at some point in the

> Ah!  Well, I guess I could use _exit() as well...
> Any preference between the two?

I don't think _exit() is a terribly good idea.  Consider the possibility
that some third-party library loaded into the backend has also established
an atexit callback, and unlike what we did, that code does need to get
control in a subprocess exit.

I'm thinking we failed to consider this situation, and really the right
thing is for atexit_callback() to defend itself against the case.
One possibility is to do this:

atexit_callback(void)
{
	if (getpid() == MyProcPid)
	{
		/* Clean up everything that must be cleaned up */
		/* ... too bad we don't know the real exit code ... */
		proc_exit_prepare(-1);
	}
}

but that's pretty off-the-cuff, so I'm not sure if it still has
failure modes.

Could you try patching atexit_callback as above, and verify that
it does what you want (with or without the on_exit_reset() in your
extension)?

			regards, tom lane


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



view thread (7+ messages)  latest in thread

Message-ID: <339.1394165896@sss.pgh.pa.us>
Permalink:  ../339.1394165896@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/339.1394165896@sss.pgh.pa.us

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, petela@gocougs.wsu.edu
  Subject: Re: BUG #9464: PANIC with 'failed to re-find shared lock object'
  In-Reply-To: <339.1394165896@sss.pgh.pa.us>
  References: <20140307005623.1918.22473@wrigleys.postgresql.org> <31620.1394163148@sss.pgh.pa.us> <CAN8Q1EcLbgeCNNXav49nOrA9uR-LYjRmonTtPrm90f6zrdn=+g@mail.gmail.com> <339.1394165896@sss.pgh.pa.us>

* 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