From: Seva Zaslavsky <szaslavsky@mpcapitallp.com>
To: David G. Johnston <david.g.johnston@gmail.com>
To: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #18958: "pg_ctl start" allows subsequent CTRL-C key in cmd.exe to unexpectedly terminate cluster on Windows
Date: Fri, 13 Jun 2025 10:51:14 -0400
Message-ID: <076f46d6-edfd-44a0-b8a7-69ee0313a6f4@mpcapitallp.com> (raw)
In-Reply-To: <CAKFQuwZZqJdJHdgDqnrcYTsVQWh7MpRR3qNLCqOgp_780TFo1A@mail.gmail.com>
References: <18958-e398048dd0cdad11@postgresql.org>
<CAKFQuwZZqJdJHdgDqnrcYTsVQWh7MpRR3qNLCqOgp_780TFo1A@mail.gmail.com>
Using the -l flag with "pg_ctl start" resolves this issue. This was a
significant behavior change since PG 13.18.
David - Thank you for the quick response. Would appreciate if you have
any thoughts on another logging bug (or behavior change since PG 13.18)
that I documented on June 11 in #18955.
On 6/13/2025 9:46 AM, David G. Johnston wrote:
> On Fri, Jun 13, 2025 at 6:34 AM PG Bug reporting form
> <noreply@postgresql.org> wrote:
>
> The following bug has been logged on the website:
>
> Bug reference: 18958
> Logged by: Seva Zaslavsky
> Email address: szaslavsky@mpcapitallp.com
> PostgreSQL version: 17.5
> Operating system: Windows Server 2019
> Description:
>
> J:\Users\Public\PostgreSQL\data>"c:\Program
> Files\PostgreSQL\17.5\bin\pg_ctl" start -D
> "J:\Users\Public\PostgreSQL\data\5438" -o "-p 5438"
> waiting for server to start....2025-06-13 08:44:06.019 EDT [10020]
> [] LOG:
> redirecting log output to logging collector process
> 2025-06-13 08:44:06.019 EDT [10020] [] HINT: Future log output
> will appear
> in directory "pg_log".
> done
> server started
>
>
> A bit surprising I suppose, but documented.
>
> """
> start mode launches a new server. The server is started in the
> background, and its standard input is attached to /dev/null (or nul on
> Windows). On Unix-like systems, by default, the server's standard
> output and standard error are sent to pg_ctl's standard output (not
> standard error). The standard output of pg_ctl should then be
> redirected to a file or piped to another process such as a log
> rotating program like rotatelogs; otherwise postgres will write its
> output to the controlling terminal (from the background) and will not
> leave the shell's process group. On Windows, by default the server's
> standard output and standard error are sent to the terminal. These
> default behaviors can be changed by using -l to append the server's
> output to a log file. Use of either -l or output redirection is
> recommended.
> """
>
> Note the final sentence, neither of which was done here.
>
> In short, while the server configuration stopped sending log data to
> stdout/stderr due to the log_collector directive pg_ctl has no
> awareness of that happening and so keeps itself attached to the
> process that launched it so the operator can see those streams.
>
> David J.
>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: szaslavsky@mpcapitallp.com, david.g.johnston@gmail.com, pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #18958: "pg_ctl start" allows subsequent CTRL-C key in cmd.exe to unexpectedly terminate cluster on Windows
In-Reply-To: <076f46d6-edfd-44a0-b8a7-69ee0313a6f4@mpcapitallp.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox