mirror of https://github.com/Icinga/icinga2.git
Override exit code on process timeout
As Icinga first sends a SIGTERM to a check plugin on timeout to allow it to terminate gracefully, this is not really part of the plugin API specification and we cannot assume that plugins will handle this correctly and still exit with an exit code that maps to UNKNOWN. Therefore, once Icinga decides to kill a process, force its exit code to 128 to be sure the state will be UNKNOWN after a timeout.
This commit is contained in:
parent
9684fe8141
commit
a55939e462
|
@ -1133,8 +1133,14 @@ bool Process::DoEvents()
|
|||
} else if (WIFEXITED(status)) {
|
||||
exitcode = WEXITSTATUS(status);
|
||||
|
||||
Log(LogNotice, "Process")
|
||||
<< "PID " << m_PID << " (" << PrettyPrintArguments(m_Arguments) << ") terminated with exit code " << exitcode;
|
||||
Log msg(LogNotice, "Process");
|
||||
msg << "PID " << m_PID << " (" << PrettyPrintArguments(m_Arguments)
|
||||
<< ") terminated with exit code " << exitcode;
|
||||
|
||||
if (m_SentSigterm) {
|
||||
exitcode = 128;
|
||||
msg << " after sending SIGTERM";
|
||||
}
|
||||
} else if (WIFSIGNALED(status)) {
|
||||
int signum = WTERMSIG(status);
|
||||
const char *zsigname = strsignal(signum);
|
||||
|
|
Loading…
Reference in New Issue