Lines 1-212
Link Here
|
1 |
From a62b1cfefc184b0c5b6d70e2d6a3de0284b31ffd Mon Sep 17 00:00:00 2001 |
|
|
2 |
From: Vladislavs Sokurenko <vladislavs.sokurenko@zabbix.com> |
3 |
Date: Thu, 29 Aug 2019 17:02:29 +0300 |
4 |
Subject: [PATCH 3/4] ...G...PS. [ZBX-16460] fixed Zabbix daemon termination on |
5 |
FreeBSD |
6 |
|
7 |
* commit '7eb515175340160a502a58eacb719d6eaf522340': |
8 |
...G...PS. [ZBX-16460] fixed Zabbix daemon termination on FreeBSD |
9 |
.......... [ZBX-16460] fixed Zabbix daemon exit on FreeBSD |
10 |
|
11 |
(cherry picked from commit 10aee49918fbf54655d4c479689c7f62a8a1b45d) |
12 |
(cherry picked from commit 890ef645e5fd678ececfeba1feb3144509d1cbd5) |
13 |
--- |
14 |
ChangeLog.d/bugfix/ZBX-16460 | 1 + |
15 |
include/threads.h | 2 +- |
16 |
src/libs/zbxcrypto/tls.c | 18 +++++++++--------- |
17 |
src/libs/zbxlog/log.c | 2 +- |
18 |
src/libs/zbxnix/fatal.c | 2 +- |
19 |
src/libs/zbxnix/sighandler.c | 8 ++++---- |
20 |
src/libs/zbxsys/threads.c | 2 +- |
21 |
src/zabbix_get/zabbix_get.c | 2 +- |
22 |
src/zabbix_sender/zabbix_sender.c | 2 +- |
23 |
src/zabbix_server/poller/checks_snmp.c | 2 +- |
24 |
10 files changed, 21 insertions(+), 20 deletions(-) |
25 |
create mode 100644 ChangeLog.d/bugfix/ZBX-16460 |
26 |
|
27 |
diff --git ChangeLog.d/bugfix/ZBX-16460 ChangeLog.d/bugfix/ZBX-16460 |
28 |
new file mode 100644 |
29 |
index 0000000000..c40d5d5ac3 |
30 |
--- /dev/null |
31 |
+++ ChangeLog.d/bugfix/ZBX-16460 |
32 |
@@ -0,0 +1 @@ |
33 |
+...G...PS. [ZBX-16460] fixed Zabbix daemon termination on FreeBSD (vso) |
34 |
diff --git include/threads.h include/threads.h |
35 |
index 2c8fef6196..c3b6d451ea 100644 |
36 |
--- include/threads.h |
37 |
+++ include/threads.h |
38 |
@@ -73,7 +73,7 @@ |
39 |
#define zbx_sleep(sec) sleep((sec)) |
40 |
|
41 |
#define zbx_thread_kill(h) kill(h, SIGUSR2) |
42 |
- #define zbx_thread_kill_fatal(h) kill(h, SIGABRT) |
43 |
+ #define zbx_thread_kill_fatal(h) kill(h, SIGHUP) |
44 |
#endif /* _WINDOWS */ |
45 |
|
46 |
typedef struct |
47 |
diff --git src/libs/zbxcrypto/tls.c src/libs/zbxcrypto/tls.c |
48 |
index eef77e6575..7bf9515ad4 100644 |
49 |
--- src/libs/zbxcrypto/tls.c |
50 |
+++ src/libs/zbxcrypto/tls.c |
51 |
@@ -2710,12 +2710,12 @@ void zbx_tls_init_child(void) |
52 |
zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __func__); |
53 |
|
54 |
#ifndef _WINDOWS |
55 |
- /* Invalid TLS parameters will cause exit. Once one process exits the parent process will send SIGABRT to */ |
56 |
+ /* Invalid TLS parameters will cause exit. Once one process exits the parent process will send SIGHUP to */ |
57 |
/* child processes which may be on their way to exit on their own - do not interrupt them, block signal */ |
58 |
- /* SIGABRT and unblock it when TLS parameters are good and libraries are initialized. */ |
59 |
+ /* SIGHUP and unblock it when TLS parameters are good and libraries are initialized. */ |
60 |
sigemptyset(&mask); |
61 |
sigaddset(&mask, SIGTERM); |
62 |
- sigaddset(&mask, SIGABRT); |
63 |
+ sigaddset(&mask, SIGHUP); |
64 |
sigaddset(&mask, SIGUSR2); |
65 |
sigaddset(&mask, SIGQUIT); |
66 |
sigprocmask(SIG_BLOCK, &mask, &orig_mask); |
67 |
@@ -2905,12 +2905,12 @@ void zbx_tls_init_child(void) |
68 |
zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __func__); |
69 |
|
70 |
#ifndef _WINDOWS |
71 |
- /* Invalid TLS parameters will cause exit. Once one process exits the parent process will send SIGABRT to */ |
72 |
+ /* Invalid TLS parameters will cause exit. Once one process exits the parent process will send SIGHUP to */ |
73 |
/* child processes which may be on their way to exit on their own - do not interrupt them, block signal */ |
74 |
- /* SIGABRT and unblock it when TLS parameters are good and libraries are initialized. */ |
75 |
+ /* SIGHUP and unblock it when TLS parameters are good and libraries are initialized. */ |
76 |
sigemptyset(&mask); |
77 |
sigaddset(&mask, SIGTERM); |
78 |
- sigaddset(&mask, SIGABRT); |
79 |
+ sigaddset(&mask, SIGHUP); |
80 |
sigaddset(&mask, SIGUSR2); |
81 |
sigaddset(&mask, SIGQUIT); |
82 |
sigprocmask(SIG_BLOCK, &mask, &orig_mask); |
83 |
@@ -3194,12 +3194,12 @@ void zbx_tls_init_child(void) |
84 |
zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __func__); |
85 |
|
86 |
#ifndef _WINDOWS |
87 |
- /* Invalid TLS parameters will cause exit. Once one process exits the parent process will send SIGABRT to */ |
88 |
+ /* Invalid TLS parameters will cause exit. Once one process exits the parent process will send SIGHUP to */ |
89 |
/* child processes which may be on their way to exit on their own - do not interrupt them, block signal */ |
90 |
- /* SIGABRT and unblock it when TLS parameters are good and libraries are initialized. */ |
91 |
+ /* SIGHUP and unblock it when TLS parameters are good and libraries are initialized. */ |
92 |
sigemptyset(&mask); |
93 |
sigaddset(&mask, SIGTERM); |
94 |
- sigaddset(&mask, SIGABRT); |
95 |
+ sigaddset(&mask, SIGHUP); |
96 |
sigaddset(&mask, SIGUSR2); |
97 |
sigaddset(&mask, SIGQUIT); |
98 |
sigprocmask(SIG_BLOCK, &mask, &orig_mask); |
99 |
diff --git src/libs/zbxlog/log.c src/libs/zbxlog/log.c |
100 |
index 916d7fb232..2e63ce8eb9 100644 |
101 |
--- src/libs/zbxlog/log.c |
102 |
+++ src/libs/zbxlog/log.c |
103 |
@@ -239,7 +239,7 @@ static void lock_log(void) |
104 |
sigaddset(&mask, SIGTERM); |
105 |
sigaddset(&mask, SIGINT); |
106 |
sigaddset(&mask, SIGQUIT); |
107 |
- sigaddset(&mask, SIGABRT); |
108 |
+ sigaddset(&mask, SIGHUP); |
109 |
|
110 |
if (0 > sigprocmask(SIG_BLOCK, &mask, &orig_mask)) |
111 |
zbx_error("cannot set sigprocmask to block the user signal"); |
112 |
diff --git src/libs/zbxnix/fatal.c src/libs/zbxnix/fatal.c |
113 |
index bda471d164..7ea6918e96 100644 |
114 |
--- src/libs/zbxnix/fatal.c |
115 |
+++ src/libs/zbxnix/fatal.c |
116 |
@@ -58,7 +58,7 @@ const char *get_signal_name(int sig) |
117 |
case SIGSEGV: return "SIGSEGV"; |
118 |
case SIGBUS: return "SIGBUS"; |
119 |
case SIGQUIT: return "SIGQUIT"; |
120 |
- case SIGABRT: return "SIGABRT"; |
121 |
+ case SIGHUP: return "SIGHUP"; |
122 |
case SIGINT: return "SIGINT"; |
123 |
case SIGTERM: return "SIGTERM"; |
124 |
case SIGPIPE: return "SIGPIPE"; |
125 |
diff --git src/libs/zbxnix/sighandler.c src/libs/zbxnix/sighandler.c |
126 |
index d244c5cc7b..96aa86c32b 100644 |
127 |
--- src/libs/zbxnix/sighandler.c |
128 |
+++ src/libs/zbxnix/sighandler.c |
129 |
@@ -95,7 +95,7 @@ static void alarm_signal_handler(int sig, siginfo_t *siginfo, void *context) |
130 |
* * |
131 |
* Function: terminate_signal_handler * |
132 |
* * |
133 |
- * Purpose: handle terminate signals: SIGABRT, SIGINT, SIGTERM, SIGUSR2 * |
134 |
+ * Purpose: handle terminate signals: SIGHUP, SIGINT, SIGTERM, SIGUSR2 * |
135 |
* * |
136 |
******************************************************************************/ |
137 |
static void terminate_signal_handler(int sig, siginfo_t *siginfo, void *context) |
138 |
@@ -103,8 +103,8 @@ static void terminate_signal_handler(int sig, siginfo_t *siginfo, void *context) |
139 |
if (!SIG_PARENT_PROCESS) |
140 |
{ |
141 |
/* the parent process can either politely ask a child process to finish it's work and perform cleanup */ |
142 |
- /* by sending SIGUSR2 or terminate child process immediately without cleanup by sending SIGABRT */ |
143 |
- if (SIGABRT == sig) |
144 |
+ /* by sending SIGUSR2 or terminate child process immediately without cleanup by sending SIGHUP */ |
145 |
+ if (SIGHUP == sig) |
146 |
exit_with_failure(); |
147 |
|
148 |
if (SIGUSR2 == sig) |
149 |
@@ -180,7 +180,7 @@ void zbx_set_common_signal_handlers(void) |
150 |
phan.sa_sigaction = terminate_signal_handler; |
151 |
sigaction(SIGINT, &phan, NULL); |
152 |
sigaction(SIGQUIT, &phan, NULL); |
153 |
- sigaction(SIGABRT, &phan, NULL); |
154 |
+ sigaction(SIGHUP, &phan, NULL); |
155 |
sigaction(SIGTERM, &phan, NULL); |
156 |
sigaction(SIGUSR2, &phan, NULL); |
157 |
|
158 |
diff --git src/libs/zbxsys/threads.c src/libs/zbxsys/threads.c |
159 |
index 16fcc3f90b..aedd12ccba 100644 |
160 |
--- src/libs/zbxsys/threads.c |
161 |
+++ src/libs/zbxsys/threads.c |
162 |
@@ -61,7 +61,7 @@ void zbx_child_fork(pid_t *pid) |
163 |
sigemptyset(&mask); |
164 |
sigaddset(&mask, SIGTERM); |
165 |
sigaddset(&mask, SIGUSR2); |
166 |
- sigaddset(&mask, SIGABRT); |
167 |
+ sigaddset(&mask, SIGHUP); |
168 |
sigaddset(&mask, SIGINT); |
169 |
sigaddset(&mask, SIGQUIT); |
170 |
sigaddset(&mask, SIGCHLD); |
171 |
diff --git src/zabbix_get/zabbix_get.c src/zabbix_get/zabbix_get.c |
172 |
index fe3152d7e2..9f3cfc6ebb 100644 |
173 |
--- src/zabbix_get/zabbix_get.c |
174 |
+++ src/zabbix_get/zabbix_get.c |
175 |
@@ -458,7 +458,7 @@ int main(int argc, char **argv) |
176 |
signal(SIGINT, get_signal_handler); |
177 |
signal(SIGQUIT, get_signal_handler); |
178 |
signal(SIGTERM, get_signal_handler); |
179 |
- signal(SIGABRT, get_signal_handler); |
180 |
+ signal(SIGHUP, get_signal_handler); |
181 |
signal(SIGALRM, get_signal_handler); |
182 |
signal(SIGPIPE, get_signal_handler); |
183 |
#endif |
184 |
diff --git src/zabbix_sender/zabbix_sender.c src/zabbix_sender/zabbix_sender.c |
185 |
index fdbdfc2a97..7440bcab66 100644 |
186 |
--- src/zabbix_sender/zabbix_sender.c |
187 |
+++ src/zabbix_sender/zabbix_sender.c |
188 |
@@ -511,7 +511,7 @@ static ZBX_THREAD_ENTRY(send_value, args) |
189 |
signal(SIGINT, send_signal_handler); |
190 |
signal(SIGQUIT, send_signal_handler); |
191 |
signal(SIGTERM, send_signal_handler); |
192 |
- signal(SIGABRT, send_signal_handler); |
193 |
+ signal(SIGHUP, send_signal_handler); |
194 |
signal(SIGALRM, send_signal_handler); |
195 |
#endif |
196 |
switch (configured_tls_connect_mode) |
197 |
diff --git src/zabbix_server/poller/checks_snmp.c src/zabbix_server/poller/checks_snmp.c |
198 |
index 08ecf71d86..68411321c1 100644 |
199 |
--- src/zabbix_server/poller/checks_snmp.c |
200 |
+++ src/zabbix_server/poller/checks_snmp.c |
201 |
@@ -2124,7 +2124,7 @@ void zbx_init_snmp(void) |
202 |
sigemptyset(&mask); |
203 |
sigaddset(&mask, SIGTERM); |
204 |
sigaddset(&mask, SIGUSR2); |
205 |
- sigaddset(&mask, SIGABRT); |
206 |
+ sigaddset(&mask, SIGHUP); |
207 |
sigaddset(&mask, SIGQUIT); |
208 |
sigprocmask(SIG_BLOCK, &mask, &orig_mask); |
209 |
|
210 |
-- |
211 |
2.23.0 |
212 |
|