From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: injection_points: Fix race condition with local injection point
Date: Tue, 09 Apr 2024 01:31:52 +0000
Message-ID: <E1ru0L1-001DhD-Rc@gemulon.postgresql.org> (raw)
injection_points: Fix race condition with local injection point tests
The module relies on a shmem exit callback to clean up any injection
points linked to a specific process. One of the tests checks for the
case of an injection point name reused in a second connection where the
first connection should clean it up, but it did not count for the fact
that the shmem exit callback of the first connection may not have run
when the second connection begins its work.
The regress library includes a wait_pid() that can be used for this
purpose, instead of a custom wait logic, so let's rely on it to wait for
the first connection to exit before working with the second connection.
The module gains a REGRESS_OPTS to be able to look at the regress
library's dlpath.
This issue could be reproduced with a hardcoded sleep() in the shmem
exit callback, and the CI has been able to trigger it sporadically.
Oversight in f587338dec87.
Reported-by: Bharath Rupireddy
Reviewed-by: Andrey Borodin
Discussion: https://postgr.es/m/ZhOd3NXAutteokGL@paquier.xyz
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/f4083c49751018ae2140de8bf752b8d60485a6ca
Modified Files
--------------
src/test/modules/injection_points/Makefile | 1 +
.../injection_points/expected/injection_points.out | 17 +++++++++++++++++
src/test/modules/injection_points/meson.build | 1 +
.../modules/injection_points/sql/injection_points.sql | 16 ++++++++++++++++
4 files changed, 35 insertions(+)
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: pgsql-committers@postgresql.org
Cc: michael@paquier.xyz, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: injection_points: Fix race condition with local injection point
In-Reply-To: <E1ru0L1-001DhD-Rc@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox