Thread: [MASSMAIL] pgsql: injection_points: Fix race condition with local injection point
[MASSMAIL] pgsql: injection_points: Fix race condition with local injection point
From
Michael Paquier
Date:
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(+)