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 1prkX2-0000Ms-Js for pgsql-hackers@arkaria.postgresql.org; Wed, 26 Apr 2023 19:10:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1prkX0-00083r-UE for pgsql-hackers@arkaria.postgresql.org; Wed, 26 Apr 2023 19:10:22 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1prkX0-00083B-JC for pgsql-hackers@lists.postgresql.org; Wed, 26 Apr 2023 19:10:22 +0000 Received: from relay11.mail.gandi.net ([217.70.178.231]) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1prkWt-005E9b-5J for pgsql-hackers@lists.postgresql.org; Wed, 26 Apr 2023 19:10:21 +0000 Received: (Authenticated sender: adsend@dunslane.net) by mail.gandi.net (Postfix) with ESMTPSA id ABADA100002; Wed, 26 Apr 2023 19:10:11 +0000 (UTC) Content-Type: multipart/alternative; boundary="------------jKxzLy0hdmhhKtQxOV4FjlbS" Message-ID: Date: Wed, 26 Apr 2023 15:10:09 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: Re: issue with meson builds on msys2 Content-Language: en-US To: Tom Lane Cc: Andres Freund , pgsql-hackers@lists.postgresql.org References: <08dd6053-deee-52e9-954b-eb69232905c9@dunslane.net> <2506819.1681761221@sss.pgh.pa.us> <7d7dcc20-ba19-5340-9be8-f255e8b42edc@dunslane.net> <20230420150652.jciazjap223iznjp@awork3.anarazel.de> <5bddd941-9819-6655-7a71-3f346050583e@dunslane.net> <6efeb45a-07f9-2291-c8f8-9fb4abbb6ebc@dunslane.net> <848511.1682519554@sss.pgh.pa.us> <851356.1682521091@sss.pgh.pa.us> <365f59bd-1aaf-0af0-46ee-89e6a0dae391@dunslane.net> <863239.1682523022@sss.pgh.pa.us> From: Andrew Dunstan In-Reply-To: <863239.1682523022@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------jKxzLy0hdmhhKtQxOV4FjlbS Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2023-04-26 We 11:30, Tom Lane wrote: > Andrew Dunstan writes: >> If I redirect the output to a file (which is what the buildfarm client >> actually does), it seems like it completes successfully, but I still get >> a non-zero exit: >> pgrunner@EC2AMAZ-GCB871B UCRT64 ~/bf >> $ /usr/bin/perl -e 'chdir "root/HEAD/instkeep.2023-04-25_11-09-41"; >> system("bin/pg_ctl -D data-C -l logfile stop > stoplog 2>&1") ; print >> "BANG\n" if $?; ' >> BANG >> pgrunner@EC2AMAZ-GCB871B UCRT64 ~/bf >> $ cat root/HEAD/instkeep.2023-04-25_11-09-41/stoplog >> waiting for server to shut down.... done >> server stopped > Thats ... just wacko. do_stop() emits "waiting for server to shut > down...", "done", and "server stopped" in the same way (via print_msg). > How is it that all three messages show up in one context but not the > other? Could wait_for_postmaster_stop or get_pgpid be bollixing the > stdout channel somehow? Try redirecting stdout and stderr separately > to see if that proves anything. Doesn't seem to prove much: pgrunner@EC2AMAZ-GCB871B UCRT64 ~/bf $ /usr/bin/perl -e 'chdir "root/HEAD/instkeep.2023-04-25_11-09-41"; system("bin/pg_ctl -D data-C -l logfile stop > stoplog.out 2> stoplog.err") ; print "BANG\n" if $?; ' BANG pgrunner@EC2AMAZ-GCB871B UCRT64 ~/bf $ cat root/HEAD/instkeep.2023-04-25_11-09-41/stoplog.out waiting for server to shut down.... done server stopped pgrunner@EC2AMAZ-GCB871B UCRT64 ~/bf $ cat root/HEAD/instkeep.2023-04-25_11-09-41/stoplog.err pgrunner@EC2AMAZ-GCB871B UCRT64 ~/bf > >> It seems more than odd that we get to where the "server stopped" massage >> is printed but we get a failure. > Indeed, that's even weirder. do_stop() returns directly to the > exit(0) in main(). > > And if I call it via IPC::Run it works: pgrunner@EC2AMAZ-GCB871B UCRT64 ~/bf $ /usr/bin/perl -e 'chdir "root/HEAD/instkeep.2023-04-25_11-09-41"; use IPC::Run; my ($out, $err) = ("",""); IPC::Run::run ["bin/pg_ctl", "-D", "data-C", "stop"], \"",\$out,\$err ; print "BANG\n" if $?; print "out: $out\n" if $out; print "err: $err\n" if $err;' out: waiting for server to shut down.... done server stopped It seems there is something odd in how msys perl (not ucrt perl) implements system() that is tickled by this, but why that should only occur when it's built using meson is completely beyond me. It should be just another executable. And pg_ctl is behaving properly as far as we can see. I'm not quite sure where to go from here. I guess I can try to see if we have IPC::Run and if so use it. That would probably get me over the hurdle for fairywren. This has already consumed far too much of my time. cheers andrew -- Andrew Dunstan EDB:https://www.enterprisedb.com --------------jKxzLy0hdmhhKtQxOV4FjlbS Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 7bit


On 2023-04-26 We 11:30, Tom Lane wrote:
Andrew Dunstan <andrew@dunslane.net> writes:
If I redirect the output to a file (which is what the buildfarm client 
actually does), it seems like it completes successfully, but I still get 
a non-zero exit:

      
pgrunner@EC2AMAZ-GCB871B UCRT64 ~/bf
$ /usr/bin/perl -e 'chdir "root/HEAD/instkeep.2023-04-25_11-09-41"; 
system("bin/pg_ctl -D data-C -l logfile stop > stoplog 2>&1") ; print 
"BANG\n" if $?; '
BANG

      
pgrunner@EC2AMAZ-GCB871B UCRT64 ~/bf
$ cat root/HEAD/instkeep.2023-04-25_11-09-41/stoplog
waiting for server to shut down.... done
server stopped
Thats ... just wacko.  do_stop() emits "waiting for server to shut
down...", "done", and "server stopped" in the same way (via print_msg).
How is it that all three messages show up in one context but not the
other?  Could wait_for_postmaster_stop or get_pgpid be bollixing the
stdout channel somehow?  Try redirecting stdout and stderr separately
to see if that proves anything.


Doesn't seem to prove much:


pgrunner@EC2AMAZ-GCB871B UCRT64 ~/bf
$ /usr/bin/perl -e 'chdir "root/HEAD/instkeep.2023-04-25_11-09-41"; system("bin/pg_ctl -D data-C -l logfile stop > stoplog.out 2> stoplog.err") ; print "BANG\n" if $?; '
BANG

pgrunner@EC2AMAZ-GCB871B UCRT64 ~/bf
$ cat root/HEAD/instkeep.2023-04-25_11-09-41/stoplog.out
waiting for server to shut down.... done
server stopped

pgrunner@EC2AMAZ-GCB871B UCRT64 ~/bf
$ cat root/HEAD/instkeep.2023-04-25_11-09-41/stoplog.err

pgrunner@EC2AMAZ-GCB871B UCRT64 ~/bf



It seems more than odd that we get to where the "server stopped" massage 
is printed but we get a failure.
Indeed, that's even weirder.  do_stop() returns directly to the
exit(0) in main().

			


And if I call it via IPC::Run it works:


pgrunner@EC2AMAZ-GCB871B UCRT64 ~/bf
$ /usr/bin/perl -e 'chdir "root/HEAD/instkeep.2023-04-25_11-09-41"; use IPC::Run; my ($out, $err) = ("",""); IPC::Run::run ["bin/pg_ctl", "-D", "data-C", "stop"], \"",\$out,\$err ; print "BANG\n" if $?; print "out: $out\n" if $out; print "err: $err\n" if $err;'
out: waiting for server to shut down.... done
server stopped


It seems there is something odd in how msys perl (not ucrt perl) implements system() that is tickled by this, but why that should only occur when it's built using meson is completely beyond me. It should be just another executable. And pg_ctl is behaving properly as far as we can see. I'm not quite sure where to go from here. I guess I can try to see if we have IPC::Run and if so use it. That would probably get me over the hurdle for fairywren. This has already consumed far too much of my time.


cheers


andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com
--------------jKxzLy0hdmhhKtQxOV4FjlbS--