Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uQ5ka-004Tje-Pz for pgsql-bugs@arkaria.postgresql.org; Fri, 13 Jun 2025 14:51:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1uQ5kW-003uLO-VN for pgsql-bugs@arkaria.postgresql.org; Fri, 13 Jun 2025 14:51:21 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1uQ5kW-003uLF-Hg for pgsql-bugs@lists.postgresql.org; Fri, 13 Jun 2025 14:51:21 +0000 Received: from mail-qt1-x831.google.com ([2607:f8b0:4864:20::831]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uQ5kU-001niu-1Z for pgsql-bugs@lists.postgresql.org; Fri, 13 Jun 2025 14:51:20 +0000 Received: by mail-qt1-x831.google.com with SMTP id d75a77b69052e-4a56cc0def0so37288431cf.3 for ; Fri, 13 Jun 2025 07:51:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mpcapitallp.com; s=google; t=1749826277; x=1750431077; darn=lists.postgresql.org; h=in-reply-to:from:content-language:references:to:subject:user-agent :mime-version:date:message-id:from:to:cc:subject:date:message-id :reply-to; bh=SVWRuem9qsKlLqHQF7EU8LTww8Ri9/cNh6HvgcApiNs=; b=Dbjw+X5XGDXoBEi3VlGY0RZInRLH1BjTESHoN4O11kgYmeQ4Thvfpe9Qmzlz38Xl8P bLCvPTt1UQVKhy8mt1qMxhLgqozsOy75jXwpP8sR9c6FgY80BiDM65PgS9PhgU8aYPR1 uUX/Ql9QFrubjDPMiwKU5K6B1/40JKfKNMmUI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749826277; x=1750431077; h=in-reply-to:from:content-language:references:to:subject:user-agent :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=SVWRuem9qsKlLqHQF7EU8LTww8Ri9/cNh6HvgcApiNs=; b=Uoe/oStRccpnHlssfrHdoHxVMh0W5an8kG7IedUWKHngwu8pn2dnXfqEHOiy6og1MP GZNEZLRE35DH4wxCqn1aYRIyFg0uLqGCVzWa2vCS3KbvpsF/CjAGUJJU4rh7PCmuKbJz lmJjgDDfGaPpWSOzOPpeNdlYcxpFyBi0jbkm/DGDrm0cx54Iu5uCcj36WFXRcpbVsSUo 88nxF7//t2O4eGZ/E7ACI0F30VZKLVPhU2tAzbxpjN0zLl+wMObeWC63KYmyejwJVUYD wJIrvnJ9Wa9w8lmh1lq3HpSrMc3JTRZrW960M0CmfKN1VUL92HgjQv7A7NmKc52UHQcs NUag== X-Forwarded-Encrypted: i=1; AJvYcCWI4AploD3OF8KmUdcGE3pjspGAQTsvSrwzTbVWiay5Fwi3KxmjcuZKzWi5z88ypdiDCpThwd66+j//@lists.postgresql.org X-Gm-Message-State: AOJu0YwqGvrZM6rz85Qn4FEheh+vFdLpwmGCLZeNBb74EWpqDGGBbwdd eoj44drPXgRNtU4Ljr/aa4Cs4H/MmZMJv0sLEGNAaD4YFL0QL2YJuhqu4ZQVEYelYWc= X-Gm-Gg: ASbGnctKyarclzwX9afs5rRgDZmolSZrampr8YhGDvTZtRMEh+FVpjuUSCqSjURfkF5 zfRrrgQzsnEsOlVXFD6IAG4Gu/3VBgRVMvywyqe9Dm/86Pp0yN1I2hqiaYfnr+DnGSBgdQPfx6B DnnMlVMl0ApmEbxJzvHr7TiHbd50XYmHIu05LL1xa9Jv03SFrykpRjxYYKwKcE4d671mMrudnvb MHk/kkf0pXQr+mdqdiYb7gh76tz92jwPmfqSwPrDmmCm0bZeBdb0pp0dQnW1MdtpPCMsYIGFBV3 hvk6AlM9Y5z5oNeNNgN//4FRBUs5ivxRLFCy415dV30vQYnoJzpozR69KuIZSIX7/yiKw1p8Syl 5Y9tsoOAbvdFJlJqZnTTNniD3aUkes1QC4u74xIWWH+E0DrID71LRiETrblu68fgNqlus8g== X-Google-Smtp-Source: AGHT+IEr8afNv+MFwulsP51g+e2Vbv52DBTZTO3k6+4HH7NkTDgXZO+QceSErsMzSheKXmzAXTI1Ww== X-Received: by 2002:a05:6214:27cc:b0:6fa:fe02:8219 with SMTP id 6a1803df08f44-6fb3e57c9ffmr50291646d6.7.1749826277316; Fri, 13 Jun 2025 07:51:17 -0700 (PDT) Received: from [192.168.1.11] (pool-71-187-196-198.nwrknj.fios.verizon.net. [71.187.196.198]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6fb35c6bf5dsm22328036d6.97.2025.06.13.07.51.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 13 Jun 2025 07:51:17 -0700 (PDT) Content-Type: multipart/alternative; boundary="------------xOTSPNpSWc09V0qViypE0omr" Message-ID: <076f46d6-edfd-44a0-b8a7-69ee0313a6f4@mpcapitallp.com> Date: Fri, 13 Jun 2025 10:51:14 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: BUG #18958: "pg_ctl start" allows subsequent CTRL-C key in cmd.exe to unexpectedly terminate cluster on Windows To: "David G. Johnston" , pgsql-bugs@lists.postgresql.org References: <18958-e398048dd0cdad11@postgresql.org> Content-Language: en-US From: Seva Zaslavsky In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------xOTSPNpSWc09V0qViypE0omr Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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 > 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. > --------------xOTSPNpSWc09V0qViypE0omr Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit

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.

--------------xOTSPNpSWc09V0qViypE0omr--