Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mMGXq-0003CN-Um for pgsql-hackers@arkaria.postgresql.org; Fri, 03 Sep 2021 21:16:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mMGXp-0000Q4-UO for pgsql-hackers@arkaria.postgresql.org; Fri, 03 Sep 2021 21:16:17 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mMGXp-0000Pw-LH for pgsql-hackers@lists.postgresql.org; Fri, 03 Sep 2021 21:16:17 +0000 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mMGXl-0004tC-QQ for pgsql-hackers@lists.postgresql.org; Fri, 03 Sep 2021 21:16:17 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.west.internal (Postfix) with ESMTP id 91BBA3200937; Fri, 3 Sep 2021 17:16:10 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Fri, 03 Sep 2021 17:16:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=iR5JAHhaYa40rGWZh1cZz5jhYZoCiCa37ubBfMl5sco=; b=ZO1jKWMa X/GXPzWzTDe+w2Nrj1LzZx+RK3kELVfa0hBDHs6bu53ZBGQi+2fgKRGE/17plZET aEu1mi2AWsItB95n589/2IncrX5Z1lyOaChonnLfTvhNoHfPOE129tEHic7VgB9S OttlgFvdUgffRZ/+X90lUPZkseaiR7YptA/STHUibj4MAoU7CTFR4+Bv/Oy3RVdN GY5sdY0zH0VqlfF1S0OYHSlOyWf81Q870CRZTsHXzn+nvnH8WvXpzPgTQJS8ZEhJ bN/KKyPad931DxehBLsCW6D/u1UkYWlDCxmwgLBx3sqW1gfKRuTGFcknMesIh6ul TVyIcDt2/kDK1Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddruddvjedgudehiecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhepfffhvffukfggtggugfgjsehmke erredttdejnecuhfhrohhmpeetlhhvrghrohcujfgvrhhrvghrrgcuoegrlhhvhhgvrhhr vgesrghlvhhhrdhnohdqihhprdhorhhgqeenucggtffrrghtthgvrhhnpefggefgvddtff fftdejueeiteekiefguedvteejteeuieeghedtieetgfffffdtheenucffohhmrghinhep phhoshhtghhrrdgvshdpvghnthgvrhhprhhishgvuggsrdgtohhmnecuvehluhhsthgvrh fuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghlvhhhvghrrhgvsegrlhhv hhdrnhhoqdhiphdrohhrgh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 3 Sep 2021 17:16:09 -0400 (EDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 6774E2A07D0; Fri, 3 Sep 2021 17:16:06 -0400 (-04) Date: Fri, 3 Sep 2021 17:16:06 -0400 From: Alvaro Herrera To: Tom Lane Cc: =?utf-8?B?6JSh5qKm5aifKOeOiuS6jik=?= , pgsql-hackers Subject: Re: Add guc to enable send SIGSTOP to peers when backend exits abnormally Message-ID: <202109032116.mipfjjjgimw5@alvherre.pgsql> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="wetnbohpod6fdlh6" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <2498875.1630679973@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --wetnbohpod6fdlh6 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit On 2021-Sep-03, Tom Lane wrote: > "=?UTF-8?B?6JSh5qKm5aifKOeOiuS6jik=?=" writes: > > I want to share a patch with you, in which I add a guc parameter 'enable_send_stop' to enable set the value of SendStop in postmaster.c more conveniently. SendStop enable postmaster to send SIGSTOP rather than SIGQUIT to its children when some backend dumps core, and this variable is originally set with -T parameter when start postgres, which is inconvenient to control in some scenarios. > > TBH, I'd sooner rip out SendStop, and simplify the related postmaster > logic. I wrote a patch to do that in 2012, after this exchange: https://postgr.es/m/1333124720-sup-6193@alvh.no-ip.org I obviously doesn't apply at all anymore, but the thing that prevented me from sending it was I couldn't find what the mentioned feature was that would cause all backends to dump core at the time of a crash. So it seemed to me that we would be ripping out a feature I had used, with no replacement. (It applies cleanly on top of 36b7e3da17bc.) -- Álvaro Herrera 39°49'30"S 73°17'W — https://www.EnterpriseDB.com/ "Cuando no hay humildad las personas se degradan" (A. Christie) --wetnbohpod6fdlh6 Content-Type: text/x-diff; charset=utf-8 Content-Disposition: attachment; filename="0001-Remove-T-postmaster-option.patch" From d8198f6ad6c814c03c486bcce696fda912393405 Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Wed, 23 May 2012 22:18:21 -0400 Subject: [PATCH] Remove -T postmaster option This used to tell postmaster to send SIGSTOP instead of SIGQUIT in case of trouble, with the intent of letting a hypothetical PG hacker collect core dumps from every backends by attaching a debugger to them, one by one. This has long been superseded by the ability of current operating systems to dump core of several processes simultaneously. --- src/backend/postmaster/postmaster.c | 52 +++++++++-------------------- 1 file changed, 16 insertions(+), 36 deletions(-) diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c index eeea933b19..bf6166caf4 100644 --- a/src/backend/postmaster/postmaster.c +++ b/src/backend/postmaster/postmaster.c @@ -187,7 +187,6 @@ static char ExtraOptions[MAXPGPATH]; * shared data structures. (Reinit is currently dead code, though.) */ static bool Reinit = true; -static int SendStop = false; /* still more option variables */ bool EnableSSL = false; @@ -544,7 +543,7 @@ PostmasterMain(int argc, char *argv[]) * tcop/postgres.c (the option sets should not conflict) and with the * common help() function in main/main.c. */ - while ((opt = getopt(argc, argv, "A:B:bc:C:D:d:EeFf:h:ijk:lN:nOo:Pp:r:S:sTt:W:-:")) != -1) + while ((opt = getopt(argc, argv, "A:B:bc:C:D:d:EeFf:h:ijk:lN:nOo:Pp:r:S:st:W:-:")) != -1) { switch (opt) { @@ -654,16 +653,6 @@ PostmasterMain(int argc, char *argv[]) SetConfigOption("log_statement_stats", "true", PGC_POSTMASTER, PGC_S_ARGV); break; - case 'T': - - /* - * In the event that some backend dumps core, send SIGSTOP, - * rather than SIGQUIT, to all its peers. This lets the wily - * post_hacker collect core dumps from everyone. - */ - SendStop = true; - break; - case 't': { const char *tmp = get_stats_option_name(optarg); @@ -2704,9 +2693,7 @@ HandleChildCrash(int pid, int exitstatus, const char *procname) * to commit hara-kiri. * * SIGQUIT is the special signal that says exit without proc_exit - * and let the user know what's going on. But if SendStop is set - * (-s on command line), then we send SIGSTOP instead, so that we - * can get core dumps from all backends by hand. + * and let the user know what's going on. * * We could exclude dead_end children here, but at least in the * SIGSTOP case it seems better to include them. @@ -2715,9 +2702,8 @@ HandleChildCrash(int pid, int exitstatus, const char *procname) { ereport(DEBUG2, (errmsg_internal("sending %s to process %d", - (SendStop ? "SIGSTOP" : "SIGQUIT"), - (int) bp->pid))); - signal_child(bp->pid, (SendStop ? SIGSTOP : SIGQUIT)); + "SIGQUIT", (int) bp->pid))); + signal_child(bp->pid, SIGQUIT); } } } @@ -2729,9 +2715,8 @@ HandleChildCrash(int pid, int exitstatus, const char *procname) { ereport(DEBUG2, (errmsg_internal("sending %s to process %d", - (SendStop ? "SIGSTOP" : "SIGQUIT"), - (int) StartupPID))); - signal_child(StartupPID, (SendStop ? SIGSTOP : SIGQUIT)); + "SIGQUIT", (int) StartupPID))); + signal_child(StartupPID, SIGQUIT); } /* Take care of the bgwriter too */ @@ -2741,9 +2726,8 @@ HandleChildCrash(int pid, int exitstatus, const char *procname) { ereport(DEBUG2, (errmsg_internal("sending %s to process %d", - (SendStop ? "SIGSTOP" : "SIGQUIT"), - (int) BgWriterPID))); - signal_child(BgWriterPID, (SendStop ? SIGSTOP : SIGQUIT)); + "SIGQUIT", (int) BgWriterPID))); + signal_child(BgWriterPID, SIGQUIT); } /* Take care of the checkpointer too */ @@ -2753,9 +2737,8 @@ HandleChildCrash(int pid, int exitstatus, const char *procname) { ereport(DEBUG2, (errmsg_internal("sending %s to process %d", - (SendStop ? "SIGSTOP" : "SIGQUIT"), - (int) CheckpointerPID))); - signal_child(CheckpointerPID, (SendStop ? SIGSTOP : SIGQUIT)); + "SIGQUIT", (int) CheckpointerPID))); + signal_child(CheckpointerPID, SIGQUIT); } /* Take care of the walwriter too */ @@ -2765,9 +2748,8 @@ HandleChildCrash(int pid, int exitstatus, const char *procname) { ereport(DEBUG2, (errmsg_internal("sending %s to process %d", - (SendStop ? "SIGSTOP" : "SIGQUIT"), - (int) WalWriterPID))); - signal_child(WalWriterPID, (SendStop ? SIGSTOP : SIGQUIT)); + "SIGQUIT", (int) WalWriterPID))); + signal_child(WalWriterPID, SIGQUIT); } /* Take care of the walreceiver too */ @@ -2777,9 +2759,8 @@ HandleChildCrash(int pid, int exitstatus, const char *procname) { ereport(DEBUG2, (errmsg_internal("sending %s to process %d", - (SendStop ? "SIGSTOP" : "SIGQUIT"), - (int) WalReceiverPID))); - signal_child(WalReceiverPID, (SendStop ? SIGSTOP : SIGQUIT)); + "SIGQUIT", (int) WalReceiverPID))); + signal_child(WalReceiverPID, SIGQUIT); } /* Take care of the autovacuum launcher too */ @@ -2789,9 +2770,8 @@ HandleChildCrash(int pid, int exitstatus, const char *procname) { ereport(DEBUG2, (errmsg_internal("sending %s to process %d", - (SendStop ? "SIGSTOP" : "SIGQUIT"), - (int) AutoVacPID))); - signal_child(AutoVacPID, (SendStop ? SIGSTOP : SIGQUIT)); + "SIGQUIT", (int) AutoVacPID))); + signal_child(AutoVacPID, SIGQUIT); } /* -- 2.30.2 --wetnbohpod6fdlh6--