Re: Assertion failure on PG15 with modified test_shm_mq test - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Assertion failure on PG15 with modified test_shm_mq test
Date
Msg-id 20220818000842.yv3cppcinxvvaavn@awork3.anarazel.de
Whole thread Raw
In response to Assertion failure on PG15 with modified test_shm_mq test  (Pavan Deolasee <pavan.deolasee@gmail.com>)
Responses Re: Assertion failure on PG15 with modified test_shm_mq test
List 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



pgsql-hackers by date:

Previous
From: David Rowley
Date:
Subject: Re: Add proper planner support for ORDER BY / DISTINCT aggregates
Next
From: Michael Paquier
Date:
Subject: Re: shadow variables - pg15 edition