Re: No Callbacks on FATAL

From: Andres Freund <andres(at)anarazel(dot)de>
To: Ed Behn <ed(at)behn(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: No Callbacks on FATAL
Date: 2023-01-11 23:04:32
Message-ID: 20230111230432.nbnzya2vbflez5tb@awork3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2023-01-11 17:47:28 -0500, Ed Behn wrote:
> I'm developing a module that implements Haskell as a procedural language (
> https://www.postgresql.org/about/news/plhaskell-v10-released-2519/)
>
> I'm using a callback function that is called when a memory context is
> deleted to remove a temporary file. This works fine when the transaction
> ends normally or raises an ERROR. However, when a FATAL event happens, the
> callback is not run. Is this a bug or intended behaviour? I think that this
> is a new behavior and that the callback was called in an earlier version
> (perhaps v14) when I was originally developing this code. I'm running
> v15.1.
>
> It seems to me that callbacks should be run in the event of a FATAL event
> in order to clean up any lingering issues.

I think you need to provide a bit more details to allow us to analyze this. I
assume you're talking about a MemoryContextRegisterResetCallback()? Which
memory context are you registering the callback on? What FATAL error is
preventing the cleanup from happening?

Even better would be a way to reproduce this without needing to build an
external extension with its own dependencies. Perhaps you can hack it into one
of the contrib/ modules?

Greetings,

Andres Freund

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2023-01-11 23:05:32 Re: pgsql: Doc: add XML ID attributes to <sectN> and <varlistentry> tags.
Previous Message Andres Freund 2023-01-11 23:00:45 Re: Show various offset arrays for heap WAL records