public inbox for [email protected]
help / color / mirror / Atom feedFrom: Tristan Partin <[email protected]>
To: [email protected]
Subject: Handle SIGTERM in fe_utils/cancel.c
Date: Mon, 22 May 2023 12:26:34 -0500
Message-ID: <CSSZDYRQQB7H.3SYPR0BMR3Q74@c3po> (raw)
Hello,
This is a way that would solve bug #17698[1]. It just reuses the same
handler as SIGINT (with a function rename).
This patch works best if it is combined with my previous submission[2].
I can rebase that submission if and when this patch is pulled in.
[1]: https://www.postgresql.org/message-id/17698-58a6ab8caec496b0%40postgresql.org
[2]: https://www.postgresql.org/message-id/CSSWBAX56CVY.291H6ZNNHK7EO%40c3po
--
Tristan Partin
Neon (https://neon.tech)
Attachments:
[text/x-patch] v1-0001-Handle-SIGTERM-in-fe_utils-cancel.c.patch (1.4K, ../CSSZDYRQQB7H.3SYPR0BMR3Q74@c3po/2-v1-0001-Handle-SIGTERM-in-fe_utils-cancel.c.patch)
download | inline diff:
From 42db43794c38341a088570e0033a945cc077a350 Mon Sep 17 00:00:00 2001
From: Tristan Partin <[email protected]>
Date: Mon, 22 May 2023 12:12:06 -0500
Subject: [PATCH postgres v1] Handle SIGTERM in fe_utils/cancel.c
This is the same handling as SIGINT.
This issue was originally reported in
https://www.postgresql.org/message-id/17698-58a6ab8caec496b0%40postgresql.org.
---
src/fe_utils/cancel.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/fe_utils/cancel.c b/src/fe_utils/cancel.c
index 10c0cd4554..b13003d405 100644
--- a/src/fe_utils/cancel.c
+++ b/src/fe_utils/cancel.c
@@ -150,7 +150,7 @@ ResetCancelConn(void)
* is set.
*/
static void
-handle_sigint(SIGNAL_ARGS)
+handle_signal(SIGNAL_ARGS)
{
int save_errno = errno;
char errbuf[256];
@@ -180,7 +180,7 @@ handle_sigint(SIGNAL_ARGS)
/*
* setup_cancel_handler
*
- * Register query cancellation callback for SIGINT.
+ * Register query cancellation callback for SIGINT and SIGTERM.
*/
void
setup_cancel_handler(void (*query_cancel_callback) (void))
@@ -189,7 +189,8 @@ setup_cancel_handler(void (*query_cancel_callback) (void))
cancel_sent_msg = _("Cancel request sent\n");
cancel_not_sent_msg = _("Could not send cancel request: ");
- pqsignal(SIGINT, handle_sigint);
+ pqsignal(SIGINT, handle_signal);
+ pqsignal(SIGTERM, handle_signal);
}
#else /* WIN32 */
--
--
Tristan Partin
Neon (https://neon.tech)
view thread (2+ messages)
reply
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: [email protected]
Cc: [email protected]
Subject: Re: Handle SIGTERM in fe_utils/cancel.c
In-Reply-To: <CSSZDYRQQB7H.3SYPR0BMR3Q74@c3po>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox