Re: Assertion failure in HEAD and 13 after calling COMMIT in a stored proc

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Jim Nasby <nasbyj(at)amazon(dot)com>
Cc: "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: Assertion failure in HEAD and 13 after calling COMMIT in a stored proc
Date: 2021-06-22 06:34:20
Message-ID: YNGEbIz5iVqRzIhJ@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jun 21, 2021 at 04:19:27PM -0700, Jim Nasby wrote:
> The following generates an assertion failure. Quick testing with start and
> stop as well as the core dump shows it’s failing on the execution of
> `schema_name := schema_name(i)` immediately after COMMIT, because there’s no
> active snapshot. On a build without asserts I get a failure in
> GetActiveSnapshot() (second stack trace). This works fine on 12_STABLE, but
> fails on 13_STABLE and HEAD.

A bisect run points me to the following commit:
commit 73b06cf893c9d3bb38c11878a12cc29407e78b6c
Author: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Date: Fri Nov 22 15:02:18 2019 -0500

Avoid taking a new snapshot for an immutable simple expression in plpgsql.

Snapshots would be taken when using non-immutable functions. I'd need
to study more this code to grab if we could improve the situation
after committing the transaction, but, Tom, shouldn't we enforce a
snapshot in the case where the expression has not been prepared for
execution in the new XACT, even for the immutable case? It seems to
me that this refers to the case where expr_simple_lxid is still
invalid, no?
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Noah Misch 2021-06-22 06:42:12 Re: intermittent failures in Cygwin from select_parallel tests
Previous Message Amit Kapila 2021-06-22 06:15:17 Re: Doc chapter for Hash Indexes