-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Backport haproxy/haproxy@d3c20b0 into stable until 3.1.1 is released
Saves 6+ minutes in each CI run
- Loading branch information
1 parent
b31e8ad
commit c7196a6
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
haproxy/patches-stable/0001-bug-minor-register-sigint-handler-in-signal_init.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
From d3c20b02469dea6f46369bb91965d8b4924bb2b7 Mon Sep 17 00:00:00 2001 | ||
From: Valentine Krasnobaeva <[email protected]> | ||
Date: Mon, 2 Dec 2024 14:47:17 +0100 | ||
Subject: [PATCH] BUG/MINOR: signal: register default handler for SIGINT in | ||
signal_init() | ||
|
||
When haproxy is launched in a background and in a subshell (see example below), | ||
according to POSIX standard (2.11. Signals and Error Handling), it inherits | ||
from the subshell SIG_IGN signal handler for SIGINT and SIGQUIT. | ||
|
||
$ (./haproxy -f env4.cfg &) | ||
|
||
So, when haproxy is lanched like this, it doesn't stop upon receiving | ||
the SIGINT. This can be a root cause of some unexpected timeouts, when haproxy | ||
is started under VTest, as VTest sends to the process SIGINT in order to | ||
terminate it. To fix this, let's explicitly register the default signal | ||
handler for the SIGINT in signal_init() initcall. | ||
|
||
This should be backported in all stable versions. | ||
--- | ||
src/signal.c | 7 +++++++ | ||
1 file changed, 7 insertions(+) | ||
|
||
diff --git a/src/signal.c b/src/signal.c | ||
index 1bb60eb82b6cc..9dfb5dc4b51b5 100644 | ||
--- a/src/signal.c | ||
+++ b/src/signal.c | ||
@@ -106,6 +106,13 @@ static void signal_init() | ||
{ | ||
int sig; | ||
|
||
+ /* Need to register the handler for SIGINT explicitly, as we can be | ||
+ * laucned within the subshell and at background: | ||
+ * $ (./haproxy -f env4.cfg &). According to POSIX standard | ||
+ * (2.11. Signals and Error Handling), we will inherit from the subshell | ||
+ * in this case SIG_IGN signal handler for SIGINT and SIGQUIT. | ||
+ */ | ||
+ signal(SIGINT, SIG_DFL); | ||
signal_queue_len = 0; | ||
memset(signal_queue, 0, sizeof(signal_queue)); | ||
memset(signal_state, 0, sizeof(signal_state)); |