public inbox for [email protected]
help / color / mirror / Atom feedFrom: Michael Paquier <[email protected]>
To: Jacob Champion <[email protected]>
Cc: Andres Freund <[email protected]>
Cc: Robert Haas <[email protected]>
Cc: Noah Misch <[email protected]>
Cc: Andrew Dunstan <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Cc: Euler Taveira <[email protected]>
Cc: Daniel Gustafsson <[email protected]>
Subject: Re: [PATCH] pg_stat_activity: make slow/hanging authentication more visible
Date: Wed, 5 Mar 2025 13:45:12 +0900
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAOYmi+=tkATXFmvvAzwLTwq52YrezFopeoPrkW3pXv6LDFYT6A@mail.gmail.com>
References: <[email protected]>
<CAOYmi+n1_s0-pomOPEY4eAEuwr8fJZKDsgCFjfrsC8qUsi7Umg@mail.gmail.com>
<[email protected]>
<CAOYmi+kNQQpT_dmB7vzVf3J+TUu6rwiHXbVTMc67+mh_x9DqXg@mail.gmail.com>
<CAOYmi+k=-ZdzfmaQwpRKodDHChoyNN-uxbD_G7zY_5cWz+yvhA@mail.gmail.com>
<[email protected]>
<[email protected]>
<soexrl7oeyku24bj3czupxmv27ow35u6edymp5y3oyoysbe2kb@r3tgoos2xp2x>
<CAOYmi+kA2VNne4AofaMv-C7vYSmdcAXaFWh3W4Nw11c0Rc+QgA@mail.gmail.com>
<CAOYmi+=tkATXFmvvAzwLTwq52YrezFopeoPrkW3pXv6LDFYT6A@mail.gmail.com>
On Tue, Mar 04, 2025 at 04:53:14PM -0800, Jacob Champion wrote:
> I'll work on a fix, but it probably won't be fast since I need to
> learn more about the injection points architecture. The test may need
> to be disabled, or the patch backed out, depending on how painful the
> flake is for everybody.
Oops, missed these failures.. So we have a race condition where we
are trying to wake up a point that's not waiting yet, because there is
a small window between the moment when the backend entry is marked as
"starting" and the injection point wait.
What this is telling us is that we should change the query scanning
pg_stat_activity for a PID of a backend in 'starting' state so as we
also check the wait_event init-pre-auth, as this is reported when
using injection point waits. The attached should be enough to take
care of this race condition.
--
Michael
Attachments:
[text/x-diff] 0001-Fix-race-condition-in-pre-auth-test.patch (1.2K, ../[email protected]/2-0001-Fix-race-condition-in-pre-auth-test.patch)
download | inline diff:
From d5c976dc995bf09c4868e0b07d4652dabcaec888 Mon Sep 17 00:00:00 2001
From: Michael Paquier <[email protected]>
Date: Wed, 5 Mar 2025 13:30:43 +0900
Subject: [PATCH] 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 a638226dbaf1..90aaea4b5a64 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.47.2
[application/pgp-signature] signature.asc (833B, ../[email protected]/3-signature.asc)
download
view thread (24+ messages) latest in thread
reply
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: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: Re: [PATCH] pg_stat_activity: make slow/hanging authentication more visible
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox