mirror of https://github.com/Icinga/icinga2.git
Report failure to kill check command after exceeding timeout
refs #4981
This commit is contained in:
parent
2932651b64
commit
c45529b407
|
@ -34,6 +34,7 @@
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
# include <execvpe.h>
|
# include <execvpe.h>
|
||||||
# include <poll.h>
|
# include <poll.h>
|
||||||
|
# include <string.h>
|
||||||
|
|
||||||
# ifndef __APPLE__
|
# ifndef __APPLE__
|
||||||
extern char **environ;
|
extern char **environ;
|
||||||
|
@ -209,10 +210,12 @@ static Value ProcessKillImpl(struct msghdr *msgh, const Dictionary::Ptr& request
|
||||||
pid_t pid = request->Get("pid");
|
pid_t pid = request->Get("pid");
|
||||||
int signum = request->Get("signum");
|
int signum = request->Get("signum");
|
||||||
|
|
||||||
int rc = kill(pid, signum);
|
errno = 0;
|
||||||
|
kill(pid, signum);
|
||||||
|
int error = errno;
|
||||||
|
|
||||||
Dictionary::Ptr response = new Dictionary();
|
Dictionary::Ptr response = new Dictionary();
|
||||||
response->Set("rc", rc);
|
response->Set("errno", error);
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
@ -452,7 +455,7 @@ send_message:
|
||||||
String jresponse = String(buf, buf + rc);
|
String jresponse = String(buf, buf + rc);
|
||||||
|
|
||||||
Dictionary::Ptr response = JsonDecode(jresponse);
|
Dictionary::Ptr response = JsonDecode(jresponse);
|
||||||
return response->Get("rc");
|
return response->Get("errno");
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ProcessWaitPID(pid_t pid, int *status)
|
static int ProcessWaitPID(pid_t pid, int *status)
|
||||||
|
@ -1020,7 +1023,11 @@ bool Process::DoEvents(void)
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
TerminateProcess(m_Process, 1);
|
TerminateProcess(m_Process, 1);
|
||||||
#else /* _WIN32 */
|
#else /* _WIN32 */
|
||||||
ProcessKill(-m_Process, SIGKILL);
|
int error = ProcessKill(-m_Process, SIGKILL);
|
||||||
|
if (error)
|
||||||
|
Log(LogWarning, "Process")
|
||||||
|
<< "Couldn't kill the process group " << m_PID << " (" << PrettyPrintArguments(m_Arguments)
|
||||||
|
<< "): [errno " << error << "] " << strerror(error);
|
||||||
#endif /* _WIN32 */
|
#endif /* _WIN32 */
|
||||||
|
|
||||||
is_timeout = true;
|
is_timeout = true;
|
||||||
|
|
Loading…
Reference in New Issue