Re: pg_ctl start may return 0 even if the postmaster has been already started on Windows

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
Cc: michael(at)paquier(dot)xyz, kuroda(dot)hayato(at)fujitsu(dot)com, shlok(dot)kyal(dot)oss(at)gmail(dot)com, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: pg_ctl start may return 0 even if the postmaster has been already started on Windows
Date: 2024-01-15 18:34:46
Message-ID: CA+TgmoZt44PEeX_=5D7RtpKShPckMyZ9+xQkTnrKU5rnZWjfpQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jan 11, 2024 at 3:33 AM Kyotaro Horiguchi
<horikyota(dot)ntt(at)gmail(dot)com> wrote:
> Is it correct to understand that you are requesting changes as follows?
>
> --- a/src/bin/pg_ctl/pg_ctl.c
> +++ b/src/bin/pg_ctl/pg_ctl.c
> @@ -1995,11 +1995,14 @@ pgwin32_find_postmaster_pid(pid_t shell_pid)
> *
> * Check for duplicate processes to ensure reliability.
> *
> - * The launcher shell might start other cmd.exe instances or programs
> - * besides postgres.exe. Verifying the program file name is essential.
> - *
> - * The launcher shell process isn't checked in this function. It will be
> - * checked by the caller.
> + * The ppe entry to be examined is identified by th32ParentProcessID, which
> + * should correspond to the cmd.exe process that executes the postgres.exe
> + * binary. Additionally, th32ProcessID in the same entry should be the PID
> + * of the launched postgres.exe. However, even though we have launched the
> + * parent cmd.exe with the /D option specified, it is sometimes observed
> + * that another cmd.exe is launched for unknown reasons. Therefore, it is
> + * crucial to verify the program file name to avoid returning the wrong
> + * PID.
> */

This kind of change looks massively helpful to me. I don't know if it
is exactly right or not, but it would have been a big help to me when
writing my previous review, so +1 for some change of this general
type.

--
Robert Haas
EDB: http://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2024-01-15 19:01:54 Re: postgres_fdw fails to see that array type belongs to extension
Previous Message Robert Haas 2024-01-15 18:30:08 Re: Oversight in reparameterize_path_by_child leading to executor crash