Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nZSUI-0005Io-Ax for pgsql-committers@arkaria.postgresql.org; Wed, 30 Mar 2022 07:11:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nZSTJ-0003hg-9G for pgsql-committers@arkaria.postgresql.org; Wed, 30 Mar 2022 07:10:25 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nZSTJ-0003hT-2J for pgsql-committers@lists.postgresql.org; Wed, 30 Mar 2022 07:10:25 +0000 Received: from smtp.outgoing.loopia.se ([93.188.3.37]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nZSTF-0005Sk-Uy for pgsql-committers@lists.postgresql.org; Wed, 30 Mar 2022 07:10:24 +0000 Received: from s807.loopia.se (localhost [127.0.0.1]) by s807.loopia.se (Postfix) with ESMTP id A968E2F1BA87 for ; Wed, 30 Mar 2022 09:10:18 +0200 (CEST) Received: from s645.loopia.se (unknown [172.22.191.5]) by s807.loopia.se (Postfix) with ESMTP id 9979C2E2AF36; Wed, 30 Mar 2022 09:10:18 +0200 (CEST) Received: from s475.loopia.se (unknown [172.22.191.5]) by s645.loopia.se (Postfix) with ESMTP id 6EDF3157C8CC; Wed, 30 Mar 2022 09:10:18 +0200 (CEST) X-Virus-Scanned: amavisd-new at amavis.loopia.se X-Spam-Flag: NO X-Spam-Score: -1 X-Spam-Level: X-Spam-Status: No, score=-1 tagged_above=-999 required=6.2 tests=[ALL_TRUSTED=-1] autolearn=disabled Received: from s499.loopia.se ([172.22.191.6]) by s475.loopia.se (s475.loopia.se [172.22.190.15]) (amavisd-new, port 10024) with UTF8LMTP id lcR3nvfgW_r6; Wed, 30 Mar 2022 09:10:18 +0200 (CEST) X-Loopia-Auth: user X-Loopia-User: daniel@yesql.se X-Loopia-Originating-IP: 89.255.232.193 Received: from [192.168.72.144] (customer-89-255-232-193.stosn.net [89.255.232.193]) (Authenticated sender: daniel@yesql.se) by s499.loopia.se (Postfix) with ESMTPSA id EDD4F1CE5F80; Wed, 30 Mar 2022 09:10:17 +0200 (CEST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.7\)) Subject: Re: pgsql: Add function to pump IPC process until string match From: Daniel Gustafsson In-Reply-To: <20220329225819.ahk5u2tax3ez6d2t@alap3.anarazel.de> Date: Wed, 30 Mar 2022 09:10:17 +0200 Cc: pgsql-committers@lists.postgresql.org, Michael Paquier Content-Transfer-Encoding: quoted-printable Message-Id: References: <20220329225819.ahk5u2tax3ez6d2t@alap3.anarazel.de> To: Andres Freund X-Mailer: Apple Mail (2.3608.120.23.2.7) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On 30 Mar 2022, at 00:58, Andres Freund wrote: > On 2022-02-23 13:32:03 +0000, Daniel Gustafsson wrote: >> Add function to pump IPC process until string match >>=20 >> Refactor the recovery tests to not carry a local duplicated copy of >> the pump_until function which pumps a process until a defined string >> is seen on a stream. This reduces duplication, and is in preparation >> for another patch which will also use this functionality. >=20 > I'm a bit disappointed by the moved function not having the diagnostic = output > that at least the version in 013_crash_restart.pl had. How is one = supposed to > figure out what caused a timeout with the new central version? Thats my bad then. Since we don't really have diag output in any module = I was going off that "precedent" when moving this over. > Given that timeouts are the only way tests using pump_until() fail, = that's not > great. They can also fail on the pumped process crashing/exiting before the = timeout without emitting the expected output. Would adding back something like the (right now untested) below be what = you're after? Looking at the perldoc I didn't see any other debugging aids we = can emit other than the stream and type of error. diff --git a/src/test/perl/PostgreSQL/Test/Utils.pm = b/src/test/perl/PostgreSQL/Test/Utils.pm index 15b314d1f8..693f2f02e5 100644 --- a/src/test/perl/PostgreSQL/Test/Utils.pm +++ b/src/test/perl/PostgreSQL/Test/Utils.pm @@ -426,8 +426,16 @@ sub pump_until while (1) { last if $$stream =3D~ /$until/; - return 0 if ($timeout->is_expired); - return 0 if (not $proc->pumpable()); + if ($timeout->is_expired) + { + diag("pump_until: timeout expired with stream: = \"$$stream\""); + return 0; + } + if (not $proc->pumpable()) + { + diag("pump_until: process terminated = unexpectedly with stream: \"$$stream\""); + return 0 + } $proc->pump(); } return 1; -- Daniel Gustafsson https://vmware.com/