Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qx7Zm-00GBFx-DI for pgsql-hackers@arkaria.postgresql.org; Sun, 29 Oct 2023 15:19:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qx7Zl-007tuu-3Z for pgsql-hackers@arkaria.postgresql.org; Sun, 29 Oct 2023 15:19:41 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qx7WT-007mIu-LI for pgsql-hackers@lists.postgresql.org; Sun, 29 Oct 2023 15:16:17 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qx7WQ-002uCe-Tr for pgsql-hackers@postgresql.org; Sun, 29 Oct 2023 15:16:16 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 39TFG1XS2133271; Sun, 29 Oct 2023 11:16:01 -0400 From: Tom Lane To: Mikhail Gribkov cc: Alexander Korotkov , Michael Paquier , Robert Haas , Daniel Gustafsson , Andres Freund , Greg Nancarrow , Ivan Panchenko , Teodor Sigaev , Ibrar Ahmed , vignesh C , Pavel Stehule , PostgreSQL Hackers , Amit Kapila , Masahiko Sawada Subject: Re: On login trigger: take three In-reply-to: References: Comments: In-reply-to Mikhail Gribkov message dated "Fri, 27 Oct 2023 09:27:13 +0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2133269.1698592561.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sun, 29 Oct 2023 11:16:01 -0400 Message-ID: <2133270.1698592561@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Mikhail Gribkov writes: > Just for a more complete picture of the final state here. > I have posted the described fix (for avoiding race condition in the test= s) > separately: > https://commitfest.postgresql.org/45/4616/ It turns out that the TAP test for this feature (006_login_trigger.pl) also has a race condition: https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=3Dmamba&dt=3D2023-= 10-28%2003%3A33%3A28 The critical bit of the log is ack Broken pipe: write( 14, 'SELECT 1;' ) at /usr/pkg/lib/perl5/vendor_per= l/5.36.0/IPC/Run/IO.pm line 550. It looks to me that what happened here is that the backend completed the authentication handshake, and then the login trigger caused a FATAL exit, and after than the connected psql session tried to send "SELECT 1" on an already-closed pipe. That failed, causing IPC::Run to panic. mamba is a fairly slow machine and doubtless has timing a bit different from what this test was created on. But I doubt there is any way to make this behavior perfectly stable across a range of machines, so I recommend just removing the test case involving a fatal exit. regards, tom lane