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

From: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>
To: 'Kyotaro Horiguchi' <horikyota(dot)ntt(at)gmail(dot)com>, "shlok(dot)kyal(dot)oss(at)gmail(dot)com" <shlok(dot)kyal(dot)oss(at)gmail(dot)com>
Cc: "michael(at)paquier(dot)xyz" <michael(at)paquier(dot)xyz>, "pgsql-hackers(at)lists(dot)postgresql(dot)org" <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: 2023-10-23 08:57:19
Message-ID: TYAPR01MB5866F5F7764669A07C7F5E2FF5D8A@TYAPR01MB5866.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dear Horiguchi-san, Shlok,

>
> At Fri, 6 Oct 2023 12:28:32 +0530, Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com> wrote
> i> D:\project\pg_dev\bin>pg_ctl -D ../data -l data2.log start
> > pg_ctl: another server might be running; trying to start server anyway
> > waiting for server to start....pg_ctl: launcher shell died
> >
> > The output message after patch is different from the HEAD. I felt that
> > with patch as well we should get the message "pg_ctl: could not start
> > server".
> > Is this message change intentional?
>
> Partly no, partly yes. My focus was on verifying the accuracy of
> identifying the actual postmaster PID on Windows. The current patch
> provides a detailed description of the events, primarily because I
> lack a comprehensive understanding of both the behavior of Windows
> APIs and the associated processes. Given that context, the messages
> essentially serve debugging purposes.
>
> I agree with your suggestion. Ultimately, if there's a possibility
> for this to be committed, the message will be consolidated to "could
> not start server".

Based on the suggestion, I tried to update the patch.
A new argument is_valid is added for reporting callee. Also, reporting formats
are adjusted based on other functions. How do you think?

Best Regards,
Hayato Kuroda
FUJITSU LIMITED

Attachment Content-Type Size
v3-0001-Disable-autoruns-for-cmd.exe-on-Windows.patch application/octet-stream 1.3 KB
v3-0002-Improve-pg_ctl-postmaster-process-check-on-Window.patch application/octet-stream 5.3 KB
v3-0003-Remove-short-sleep-from-001_start_stop.pl.patch application/octet-stream 1.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Laurenz Albe 2023-10-23 09:40:02 Re: Fix output of zero privileges in psql
Previous Message Bharath Rupireddy 2023-10-23 08:30:00 Re: [PoC] pg_upgrade: allow to upgrade publisher node