Merge pull request #66334 from aalexfvk/watchdog_keeps_unlinked_logs

Watchdog keeps descriptors of unlinked log files
This commit is contained in:
Konstantin Bogdanov 2024-07-17 14:52:47 +00:00 committed by GitHub
commit 5ce0675de8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1306,6 +1306,10 @@ void BaseDaemon::setupWatchdog()
int status = 0; int status = 0;
do do
{ {
// Close log files to prevent keeping descriptors of unlinked rotated files.
// On next log write files will be reopened.
closeLogs(logger());
if (-1 != waitpid(pid, &status, WUNTRACED | WCONTINUED) || errno == ECHILD) if (-1 != waitpid(pid, &status, WUNTRACED | WCONTINUED) || errno == ECHILD)
{ {
if (WIFSTOPPED(status)) if (WIFSTOPPED(status))