0001-Fix-race-condition-in-pre-auth-test.patch
application/octet-stream
Filename: 0001-Fix-race-condition-in-pre-auth-test.patch
Type: application/octet-stream
Part: 0
Patch
Format: format-patch
Series: patch 0001
Subject: Fix race condition in pre-auth test
| File | + | − |
|---|---|---|
| src/test/authentication/t/007_pre_auth.pl | 4 | 2 |
From efc9fc3b3993601e9611131f229fbcaf4daa46f1 Mon Sep 17 00:00:00 2001
From: Michael Paquier <michael@paquier.xyz>
Date: Wed, 5 Mar 2025 13:30:43 +0900
Subject: [PATCH 1/2] Fix race condition in pre-auth test
---
src/test/authentication/t/007_pre_auth.pl | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/test/authentication/t/007_pre_auth.pl b/src/test/authentication/t/007_pre_auth.pl
index a638226dbaf..90aaea4b5a6 100644
--- a/src/test/authentication/t/007_pre_auth.pl
+++ b/src/test/authentication/t/007_pre_auth.pl
@@ -43,12 +43,14 @@ $psql->query_safe("SELECT injection_points_attach('init-pre-auth', 'wait')");
# authentication. Use the $psql connection handle for server interaction.
my $conn = $node->background_psql('postgres', wait => 0);
-# Wait for the connection to show up.
+# Wait for the connection to show up in pg_stat_activity, with the wait_event
+# of the injection point.
my $pid;
while (1)
{
$pid = $psql->query(
- "SELECT pid FROM pg_stat_activity WHERE state = 'starting';");
+ qq{SELECT pid FROM pg_stat_activity
+ WHERE state = 'starting' and wait_event = 'init-pre-auth';});
last if $pid ne "";
usleep(100_000);
--
2.34.1