Re: 007_pre_auth.pl fails if injection_points_wakeup hits unintended process

From: Andrey Borodin <x4mmm(at)yandex-team(dot)ru>
To: Alexander Lakhin <exclusion(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Michael Paquier <michael(at)paquier(dot)xyz>
Subject: Re: 007_pre_auth.pl fails if injection_points_wakeup hits unintended process
Date: 2026-11-01 18:21:22
Message-ID: 1D3D2B7E-45F6-4FAC-9970-44E51D558FC7@yandex-team.ru
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Alexander,

On 1 Nov 2026, Alexander Lakhin wrote:
> the wakeup can hit autovacuum worker or logical replication
> launcher, not the intended client backend.

For a small fix, I'd propose restricting "init-pre-auth" to
AmRegularBackendProcess().

/* Advertising of a related patch starts here */

I also prepared a variant using the filesystem-controlled wait points
from [0]. Attached are two patches: 0001 rebases that interface onto
current master, and 0002 uses it in 007_pre_auth.pl.

The test still attaches the point through SQL and finds the client's
PID in pg_stat_activity. It then waits for
pg_injection_points/init-pre-auth/<pid> and removes that file to release
only the intended client. Waiting for the file matters because the
wait event is reported before the marker is created.

The test also parks another session at the same point before starting
the client, and checks that it remains blocked after the client reaches
idle. This makes the multiple-waiter case deterministic.

Thank you!

Best regards, Andrey Borodin.

[0] https://www.postgresql.org/message-id/AE31E3B7-A21B-4C1C-B75B-8D542A9DC633%40yandex-team.ru

Attachment Content-Type Size
v1-0001-Allow-filesystem-control-of-wait-injection-points.patch application/octet-stream 19.8 KB
v1-0002-Wake-the-pre-auth-test-s-intended-backend-by-PID.patch application/octet-stream 4.9 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2026-11-01 19:46:24 Two bugs in reconsider_full_join_clause(), handling coalesce() = const clauses
Previous Message shihao zhong 2026-11-01 17:48:23 Re: [PG19] Bogus errors for polymorphic plpython functions