Re: pg_ctl start may return 0 even if the postmaster has been already started on Windows
Kyotaro Horiguchi <horikyota.ntt@gmail.com>
From: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
To: kuroda.hayato@fujitsu.com
Cc: michael@paquier.xyz, pgsql-hackers@lists.postgresql.org
Date: 2023-09-22T07:15:51Z
Lists: pgsql-hackers
Attachments
- 0001-Disable-autoruns-for-cmd.exe-on-Windows.patch (text/x-patch)
At Wed, 20 Sep 2023 14:18:41 +0900 (JST), Kyotaro Horiguchi <horikyota.ntt@gmail.com> wrote in > I was able to see the trouble in the CI environment, but not > locally. I'll delve deeper into this. Thanks you for bringing it to my > attention. I found two instances with multiple child processes. # child-pid / parent-pid / given-pid : exec name process parent PID child PID target PID exec file shell 1228 6472 1228 cmd.exe child 5184 1228 1228 cmd.exe child 6956 1228 1228 postgres.exe > launcher shell executed multiple processes process parent PID child PID target PID exec file shell 4296 5880 4296 cmd.exe child 5156 4296 4296 agent.exe child 5640 4296 4296 postgres.exe > launcher shell executed multiple processes It looks like the environment has autorun setups for cmd.exe. There's another known issue related to auto-launching chcp at startup. Ideally, we would avoid such behavior in the postmaster-launcher shell. I think we should add "/D" flag to cmd.exe command line, perhaps in a separate patch. Even after making that change, I still see something being launched from the launcher cmd.exe... process parent PID child PID target PID exec file shell 2784 6668 2784 cmd.exe child 6140 2784 2784 MicrosoftEdgeUpdate.exe child 6260 2784 2784 postgres.exe > launcher shell executed multiple processes I'm not sure what triggers this; perhaps some other kind of hooks? If we cannot avoid this behavior, we'll have to verify the executable file name. It should be fine, given that the file name is constant, but I'm not fully convinced that this is the ideal solution. Another issue is.. that I haven't been able to cause the false positive of pg_ctl start.. Do you have a concise reproducer of the issue? regards. -- Kyotaro Horiguchi NTT Open Source Software Center
Commits
-
Re-enable autoruns for cmd.exe on Windows
- 74b8e6a69802 18.0 landed
-
Re-enable autoruns for for cmd.exe on Windows
- fa1a63dffcd7 17.0 landed
-
pg_regress: Disable autoruns for cmd.exe on Windows
- e50a52b2b448 12.18 landed
- 2a0eb80ae4ad 13.14 landed
- 4a7475e9a332 14.11 landed
- 7e7d827f57b9 15.6 landed
- 506c77f9b2e5 16.2 landed
- b83747a8a65b 17.0 landed
-
pg_ctl: Disable autoruns for cmd.exe on Windows
- 9e70e6564fc8 12.18 landed
- c8aab699edd6 13.14 landed
- 4c6944223ef4 14.11 landed
- 33d1be06aee0 15.6 landed
- 714bfb7813ed 16.2 landed
- 9886744a361b 17.0 landed