From 564e88ca3bb771f1bd19b535324b4cc6fc87f9a6 Mon Sep 17 00:00:00 2001 From: Packit Service Date: Dec 15 2020 18:00:04 +0000 Subject: Apply patch bz1868077-fix-intermittent-child-lost-messages.patch patch_name: bz1868077-fix-intermittent-child-lost-messages.patch present_in_specfile: true --- diff --git a/lib/scheduler.c b/lib/scheduler.c index 0a1c334..f6d9bad 100644 --- a/lib/scheduler.c +++ b/lib/scheduler.c @@ -1708,6 +1708,14 @@ process_threads(thread_master_t *m) * We only want timer and signal fd, and don't want inotify, vrrp socket, * snmp_read, bfd_receiver, bfd pipe in vrrp/check, dbus pipe or netlink fds. */ thread = thread_trim_head(thread_list); + + if (thread && thread->type == THREAD_CHILD_TIMEOUT) { + /* We remove the thread from the child_pid queue here so that + * if the termination arrives before we processed the timeout + * we can still handle the termination. */ + rb_erase(&thread->rb_data, &master->child_pid); + } + if (!shutting_down || (thread->type == THREAD_READY_FD && (thread->u.fd == m->timer_fd || thread->u.fd == m->signal_fd)) || @@ -1773,6 +1781,12 @@ process_child_termination(pid_t pid, int status) thread_add_terminate_event(m); } + else if (thread->type == THREAD_CHILD_TIMEOUT) { + /* The child had been timed out, but we have not processed the timeout + * and it is still on the thread->ready queue. Since we have now got + * the termination, just handle the termination instead. */ + thread->type = THREAD_CHILD_TERMINATED; + } else thread_move_ready(m, &m->child, thread, THREAD_CHILD_TERMINATED); }