]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
Fix forking and epoll/kqueue
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 27 Nov 2015 15:02:46 +0000 (15:02 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 27 Nov 2015 15:02:46 +0000 (15:02 +0000)
src/libserver/rspamd_control.c
src/libserver/worker_util.c

index 7eac7104a7ff78dc0bdd8cf6cc568e4907b197aa..58147178f7165f4ea581ed639ca2b6c1e90af9a6 100644 (file)
@@ -516,6 +516,13 @@ rspamd_srv_handler (gint fd, short what, gpointer ud)
                        msg_err ("cannot read from worker's srv pipe: %s",
                                        strerror (errno));
                }
+               else if (r == 0) {
+                       /*
+                        * Usually this means that a worker is dead, so do not try to read
+                        * anything
+                        */
+                       event_del (&worker->srv_ev);
+               }
                else if (r != sizeof (cmd)) {
                        msg_err ("cannot read from worker's srv pipe incomplete command: %d",
                                        (gint) r);
index c40c4f73f808102feebe6a16fcec44b490fa990c..ef2b8857891d1d622a2ff14148141f56c5c880f3 100644 (file)
@@ -469,6 +469,9 @@ rspamd_fork_worker (struct rspamd_main *rspamd_main,
        case 0:
                /* Update pid for logging */
                rspamd_log_update_pid (cf->type, rspamd_main->logger);
+               /* Remove the inherited event base */
+               event_reinit (rspamd_main->ev_base);
+               event_base_free (rspamd_main->ev_base);
                /* Lock statfile pool if possible XXX */
                /* Init PRNG after fork */
                rc = ottery_init (NULL);