public inbox for [email protected]  
help / color / mirror / Atom feed
From: Andres Freund <[email protected]>
To: Robert Haas <[email protected]>
Cc: Bharath Rupireddy <[email protected]>
Cc: Tom Lane <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Subject: Re: Issue with cancel_before_shmem_exit while searching to remove a particular registered exit callbacks
Date: Fri, 7 Aug 2020 14:20:22 -0700
Message-ID: <[email protected]> (raw)
In-Reply-To: <CA+TgmoY8hrNE-sO+B95M8AD6CL9VohSMik2VZkrnkbANRDS5gw@mail.gmail.com>
References: <CALj2ACWk7j4F2v2fxxYfrroOF=AdFNPr1WsV+AGtHAFQOqm_pw@mail.gmail.com>
	<[email protected]>
	<[email protected]>
	<CA+TgmoZDFyV1RAmTEKvjaV8TvvS+gKha+RRiJUGMOLoY0-8Ekw@mail.gmail.com>
	<CA+TgmobdNtd+6gr2zFH6mTSDoNAwYNt=z=Jr1h59vM+PYrbQeQ@mail.gmail.com>
	<CA+Tgmoa_VpiNjKurhkScXaZbu6s7=NP6PL0NL4fMgstXNeGfPQ@mail.gmail.com>
	<CALj2ACX6O=UnQjR7p4nED45oWzj2gXWaXgcUmk_MwfVBVMQM9A@mail.gmail.com>
	<CA+TgmoY8hrNE-sO+B95M8AD6CL9VohSMik2VZkrnkbANRDS5gw@mail.gmail.com>

Hi,

On 2020-08-07 12:29:03 -0400, Robert Haas wrote:
> On Thu, Aug 6, 2020 at 11:46 PM Bharath Rupireddy
> <[email protected]> wrote:
> > I sent the patch previously[1], but attaching here again, modifies
> > cancel_before_shmem_exit() function comment to reflect the safe usage
> > of before_shmem_exit_list callback mechanism and also removes the
> > point "For simplicity, only the latest entry can be removed*********"
> > as this gives a meaning that there is still scope for improvement in
> > cancel_before_shmem_exit() search mechanism.
> >
> > Thoughts?
> 
> I think that the first part of the comment change you suggest is a
> good idea and would avoid developer confusion, but I think that the
> statement about unordered removal of comments being risky doesn't add
> much. It's too vague to help anybody and I don't think I believe it,
> either. So I suggest something more like:
> 
> - * callback.  For simplicity, only the latest entry can be
> - * removed.  (We could work harder but there is no need for
> - * current uses.)
> + * callback.  We only look at the latest entry for removal, as we
> + * expect the caller to use before_shmem_exit callback mechanism
> + * in the LIFO order.

In which situations is the removal actually useful *and* safe, with
these constraints? You'd have to have a very narrow set of functions
that are called while the exit hook is present, i.e. basically this
would only be usable for PG_ENSURE_ERROR_CLEANUP and nothing else.  And
even there it seems like it's pretty easy to get into a situation where
it's not safe.

Greetings,

Andres Freund





view thread (28+ messages)  latest in thread

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: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Issue with cancel_before_shmem_exit while searching to remove a particular registered exit callbacks
  In-Reply-To: <[email protected]>

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

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