summaryrefslogtreecommitdiff
path: root/src/core/manager.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-06-30 15:57:39 -0700
committerGitHub <noreply@github.com>2016-06-30 15:57:39 -0700
commitb12cc5b0f80edea3faff644ad6b5c3e87d9d9940 (patch)
treef7b273d828cd4363ef2ab515c7ddf37b1a8af615 /src/core/manager.c
parent2cb623954f9df6bef85bca32933c75737ddc9a88 (diff)
parent36f20ae3b2975e44b6ef17e453ae06a289e9a122 (diff)
Merge pull request #3634 from disneyworldguy/v2sigchld
manager: Only invoke a single sigchld per unit within a cleanup cycle
Diffstat (limited to 'src/core/manager.c')
-rw-r--r--src/core/manager.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/core/manager.c b/src/core/manager.c
index 012aa6cd53..1323df7d88 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -1716,16 +1716,25 @@ static int manager_dispatch_notify_fd(sd_event_source *source, int fd, uint32_t
}
static void invoke_sigchld_event(Manager *m, Unit *u, const siginfo_t *si) {
+ uint64_t iteration;
+
assert(m);
assert(u);
assert(si);
+ sd_event_get_iteration(m->event, &iteration);
+
log_unit_debug(u, "Child "PID_FMT" belongs to %s", si->si_pid, u->id);
unit_unwatch_pid(u, si->si_pid);
- if (UNIT_VTABLE(u)->sigchld_event)
- UNIT_VTABLE(u)->sigchld_event(u, si->si_pid, si->si_code, si->si_status);
+ if (UNIT_VTABLE(u)->sigchld_event) {
+ if (set_size(u->pids) <= 1 || iteration != u->sigchldgen) {
+ UNIT_VTABLE(u)->sigchld_event(u, si->si_pid, si->si_code, si->si_status);
+ u->sigchldgen = iteration;
+ } else
+ log_debug("%s already issued a sigchld this iteration %llu, skipping. Pids still being watched %d", u->id, iteration, set_size(u->pids));
+ }
}
static int manager_dispatch_sigchld(Manager *m) {