aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-11-04 16:05:46 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-11-04 16:05:46 +0000
commit7d237da3934bec416fab604af74f61e8c53f0505 (patch)
tree67e6f07c6c3531b2a9fe318863c24e2bcec2608c
parentcd60c1621b2f90aede6584a490aa2a8abf897980 (diff)
downloadrspamd-7d237da3934bec416fab604af74f61e8c53f0505.tar.gz
rspamd-7d237da3934bec416fab604af74f61e8c53f0505.zip
[Minor] Slightly improve logging in case of termination
-rw-r--r--src/libserver/rspamd_control.c11
-rw-r--r--src/lua/lua_worker.c3
-rw-r--r--src/rspamd.c12
3 files changed, 17 insertions, 9 deletions
diff --git a/src/libserver/rspamd_control.c b/src/libserver/rspamd_control.c
index 503825184..e119e64d4 100644
--- a/src/libserver/rspamd_control.c
+++ b/src/libserver/rspamd_control.c
@@ -655,10 +655,15 @@ rspamd_control_default_worker_handler (EV_P_ ev_io *w, int revents)
r = recvmsg (w->fd, &msg, 0);
if (r == -1) {
- msg_err ("cannot read request from the control socket: %s",
- strerror (errno));
-
if (errno != EAGAIN && errno != EINTR) {
+ if (errno != ECONNRESET) {
+ /*
+ * In case of connection reset it means that main process
+ * has died, so do not pollute logs
+ */
+ msg_err ("cannot read request from the control socket: %s",
+ strerror (errno));
+ }
ev_io_stop (cd->ev_base, &cd->io_ev);
close (w->fd);
}
diff --git a/src/lua/lua_worker.c b/src/lua/lua_worker.c
index 940c6ae4a..4a3e4e908 100644
--- a/src/lua/lua_worker.c
+++ b/src/lua/lua_worker.c
@@ -841,7 +841,8 @@ lua_worker_spawn_process (lua_State *L)
/* Wait for parent to reply and exit */
rc = read (cbdata->sp[1], inbuf, sizeof (inbuf));
- if (memcmp (inbuf, "\0\0\0\0", 4) == 0) {
+ if (rc >= sizeof (inbuf) &&
+ memcmp (inbuf, "\0\0\0\0", sizeof (inbuf)) == 0) {
exit (EXIT_SUCCESS);
}
else {
diff --git a/src/rspamd.c b/src/rspamd.c
index 4b33e7577..4eed0205f 100644
--- a/src/rspamd.c
+++ b/src/rspamd.c
@@ -1092,11 +1092,13 @@ rspamd_cld_handler (EV_P_ ev_child *w, struct rspamd_main *rspamd_main,
close (wrk->srv_pipe[0]);
}
- cmd.type = RSPAMD_CONTROL_CHILD_CHANGE;
- cmd.cmd.child_change.what = rspamd_child_terminated;
- cmd.cmd.child_change.pid = wrk->pid;
- cmd.cmd.child_change.additional = w->rstatus;
- rspamd_control_broadcast_srv_cmd (rspamd_main, &cmd, wrk->pid);
+ if (!rspamd_main->wanna_die) {
+ cmd.type = RSPAMD_CONTROL_CHILD_CHANGE;
+ cmd.cmd.child_change.what = rspamd_child_terminated;
+ cmd.cmd.child_change.pid = wrk->pid;
+ cmd.cmd.child_change.additional = w->rstatus;
+ rspamd_control_broadcast_srv_cmd (rspamd_main, &cmd, wrk->pid);
+ }
if (wrk->finish_actions) {
g_ptr_array_free (wrk->finish_actions, TRUE);