diff --git a/lib/base/application.cpp b/lib/base/application.cpp index 873c399c9..676ea43d3 100644 --- a/lib/base/application.cpp +++ b/lib/base/application.cpp @@ -305,6 +305,8 @@ void Application::RunEventLoop() m_ReloadProcess = StartReloadProcess(); } #else /* _WIN32 */ + Log(LogNotice, "Application") << "Got reload command, forwarding to umbrella process (PID " << m_UmbrellaProcess << ")"; + (void)kill(m_UmbrellaProcess, SIGHUP); #endif /* _WIN32 */ } else { diff --git a/lib/cli/daemoncommand.cpp b/lib/cli/daemoncommand.cpp index 9eaeb8ea0..39fd804be 100644 --- a/lib/cli/daemoncommand.cpp +++ b/lib/cli/daemoncommand.cpp @@ -198,12 +198,17 @@ int RunWorker(const std::vector& configs) return EXIT_FAILURE; #ifndef _WIN32 - // Notify umbrella process about the config loading success. + Log(LogNotice, "cli") << "Notifying umbrella process (PID " << l_UmbrellaPid << ") about the config loading success"; + (void)kill(l_UmbrellaPid, SIGUSR2); + Log(LogNotice, "cli") << "Waiting for the umbrella process to let us doing the actual work"; + while (!l_AllowedToWork.load()) { Utility::Sleep(0.2); } + + Log(LogNotice, "cli") << "The umbrella process let us continuing"; #endif /* _WIN32 */ /* restore the previous program state */ @@ -339,6 +344,8 @@ static void NotifyWatchdog() static pid_t StartUnixWorker(const std::vector& configs) { + Log(LogNotice, "cli") << "Spawning seemless worker process doing the actual work"; + try { Application::UninitializeBase(); } catch (const std::exception& ex) { @@ -400,6 +407,8 @@ static pid_t StartUnixWorker(const std::vector& configs) l_CurrentlyStartingUnixWorkerPid.store(pid); (void)sigprocmask(SIG_UNBLOCK, &l_UnixWorkerSignals, nullptr); + Log(LogNotice, "cli") << "Spawned worker process (PID " << pid << "), waiting for it to load its config"; + for (;;) { #ifdef HAVE_SYSTEMD NotifyWatchdog(); @@ -407,8 +416,11 @@ static pid_t StartUnixWorker(const std::vector& configs) switch (l_CurrentlyStartingUnixWorkerState.load()) { case UnixWorkerState::LoadedConfig: + Log(LogNotice, "cli") << "Worker process successfully loaded its config"; break; case UnixWorkerState::Failed: + Log(LogNotice, "cli") << "Worker process couldn't load its config"; + while (waitpid(pid, nullptr, 0) == -1 && errno == EINTR) { #ifdef HAVE_SYSTEMD NotifyWatchdog(); @@ -573,6 +585,8 @@ int DaemonCommand::Run(const po::variables_map& vm, const std::vector 0) { + Log(LogNotice, "cli") << "Seemless worker (PID " << currentWorker << ") stopped, stopping as well"; + #ifdef HAVE_SYSTEMD if (!notifiedTermination) { notifiedTermination = true;