Re: Assertion failure on PG15 with modified test_shm_mq test

From: Andres Freund <andres(at)anarazel(dot)de>
To: Pavan Deolasee <pavan(dot)deolasee(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Assertion failure on PG15 with modified test_shm_mq test
Date: 2022-08-18 00:08:42
Message-ID: 20220818000842.yv3cppcinxvvaavn@awork3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 2022-08-17 11:15:28 +0530, Pavan Deolasee wrote:
> I've a slightly modified version of test_shm_mq, that I changed to include
> a shared fileset. The motivation to do that came because I hit an
> assertion failure with PG15 while doing some development work on BDR and I
> suspected it to be a PG15 bug.

> I notice that pgstat_shutdown_hook() is registered as a before-shmem-exit
> callback. The callback is responsible for detaching from the pgstat shared
> memory segment. But looks like other parts of the system still expect it to
> be available during later stages of proc exit.

> It's not clear to me if pgstat shutdown should happen later or code that
> gets executed later in the cycle should not try to use pgstat. It's also
> entirely possible that my usage of SharedFileSet is completely wrong. If
> that's the case, please let me know the mistake in the usage.

I don't think we have the infrastructure for a nice solution to this at the
moment - we need a fairly large overhaul of process initialization / shutdown
to handle these interdependencies nicely.

We can't move pgstat shutdown into on_dsm callback because that's too late to
allocate *new* dsm segments, which we might need to do while flushing
out pending stats.

See https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=fa91d4c91f28f4819dc54f93adbd413a685e366a
for a way to avoid the problem.

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2022-08-18 00:39:02 Re: shadow variables - pg15 edition
Previous Message David Rowley 2022-08-17 23:38:25 Re: Add proper planner support for ORDER BY / DISTINCT aggregates