Merge pull request #8374 from Icinga/bugfix/docker-memory-leak

icinga2 daemon: reap remaining child processes after reload
This commit is contained in:
Alexander Aleksandrovič Klimov 2020-10-16 10:33:49 +02:00 committed by GitHub
commit d6a4db935f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 0 deletions

View File

@ -781,6 +781,17 @@ int DaemonCommand::Run(const po::variables_map& vm, const std::vector<std::strin
<< "Waited for " << Utility::FormatDuration(Utility::GetTime() - start) << " on old process to exit."; << "Waited for " << Utility::FormatDuration(Utility::GetTime() - start) << " on old process to exit.";
} }
for (int info;;) {
auto pid (waitpid(-1, &info, WNOHANG));
if (pid < 1) {
break;
}
Log(LogNotice, "cli")
<< "Reaped child process " << pid << ".";
}
// Old instance shut down, allow the new one to continue working beyond config validation // Old instance shut down, allow the new one to continue working beyond config validation
(void)kill(nextWorker, SIGUSR2); (void)kill(nextWorker, SIGUSR2);