From: | Andres Freund <andres(at)anarazel(dot)de> |
---|---|
To: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Re: issue with meson builds on msys2 |
Date: | 2023-05-15 22:30:28 |
Message-ID: | 20230515223028.gkctmcoe7jtd5mmw@awork3.anarazel.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers pgsql-hackers |
Hi,
On 2023-05-15 13:13:26 -0700, Andres Freund wrote:
> It wouldn't really - the echo $? inside the system() would report the
> error. Which it doesn't - note the "0" in the second output.
Ah. Interesting. Part of the issue is perl (or msys?) swalling some error
details.
I could see more details in strace once I added another layer of shell
evaluation inside the system() call.
190 478261 [main] bash 44432 frok::parent: CreateProcessW (C:\tools\nmsys64\usr\bin\bash.exe, C:\tools\nmsys64\usr\bin\bash.exe, 0, 0, 1, 0x420, 0, 0, 0x7FFFFBE10, 0x7FFFF
BDB0)
--- Process 7152 created
[...]
1556 196093 [main] bash 44433 child_info_spawn::worker: pid 44433, prog_arg ./tmp_install/tools/nmsys64/home/pgrunner/bf/root/HEAD/inst/bin/pg_ctl, cmd line C:\tools\nmsys6
4\home\pgrunner\bf\root\HEAD\pgsql.build\tmp_install\tools\nmsys64\home\pgrunner\bf\root\HEAD\inst\bin\pg_ctl.exe -D t -w -l logfile stop)
128 196221 [main] bash 44433! child_info_spawn::worker: new process name \\?\C:\tools\nmsys64\home\pgrunner\bf\root\HEAD\pgsql.build\tmp_install\tools\nmsys64\home\pgrunne
r\bf\root\HEAD\inst\bin\pg_ctl.exe
[...]
--- Process 6136 (pid: 44433) exited with status 0x0
[...]
--- Process 7152 exited with status 0xc000013a
5292450 5816310 [waitproc] bash 44432 pinfo::maybe_set_exit_code_from_windows: pid 44433, exit value - old 0x0, windows 0xC000013A, MSYS 0x8000002
So indeed, pg_ctl exits with 0, but bash ends up with a different exit code.
What's very interesting here is that the error is 0xC000013A, which is quite
different from the 33280 that perl then reports. From what I can see bash
actually returns 0xC000013A - I don't know how perl ends up with 33280 /
0x8200 from that.
Either way, 0xC000013A is interesting - that's 0xC000013A,
STATUS_CONTROL_C_EXIT.
Very interestingly the problem vanishes as soon as I add a redirection for
standard input into the mix. Notably it suffices to redirect stdin in the
pg_ctl *start*, even if not done for pg_ctl stop. There also is no issue if
perl's stdin is redirected from /dev/null.
My guess is that msys has an issue with refcounting consoles across multiple
processes.
After that I was able to reproduce the issue without really involving perl:
bash -c './tmp_install/tools/nmsys64/home/pgrunner/bf/root/HEAD/inst/bin/pg_ctl -D t -w -l logfile start > startlog 2>&1; ./tmp_install/tools/nmsys64/home/pgrunner/bf/root/HEAD/inst/bin/pg_ctl -D t -w -l logfile stop > stoplog 2>&1; echo inner: $?'; echo outer: $?
+ bash -c './tmp_install/tools/nmsys64/home/pgrunner/bf/root/HEAD/inst/bin/pg_ctl -D t -w -l logfile start > startlog 2>&1; ./tmp_install/tools/nmsys64/home/pgrunner/bf/root/HEAD/inst/bin/pg_ctl -D t -w -l logfile stop > stoplog 2>&1; echo inner: $?'
inner: 130
+ echo outer: 0
outer: 0
If you add -e, the inner: is obviously "transferred" to the outer: output.
As soon as either the pg_ctl for the start, or the whole bash invocation, has
stdin redirected, the problem vanishes.
Greetings,
Andres Freund
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2023-05-15 23:43:56 | Re: issue with meson builds on msys2 |
Previous Message | Andres Freund | 2023-05-15 20:13:26 | Re: issue with meson builds on msys2 |
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2023-05-15 22:30:54 | Re: Introduce WAIT_EVENT_EXTENSION and WAIT_EVENT_BUFFER_PIN |
Previous Message | Jehan-Guillaume de Rorthais | 2023-05-15 22:15:02 | Re: Memory leak from ExecutorState context? |