The supervisor keeps the last child termination signal, adds it to next instance's engine status and parameters.

When the child was terminated by watchdog report SIGCHLD.


git-svn-id: http://yate.null.ro/svn/yate/trunk@4444 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2011-06-07 14:45:09 +00:00
parent da4cead867
commit 28b0ffef9f
1 changed files with 13 additions and 2 deletions

View File

@ -44,7 +44,7 @@
__declspec(dllimport) BOOL WINAPI SHGetSpecialFolderPathA(HWND,LPSTR,INT,BOOL);
#endif
#else
#else // _WINDOWS
#include "yatepaths.h"
#include <dirent.h>
@ -57,7 +57,9 @@ typedef void* HMODULE;
#define CFG_DIR ".yate"
#endif
#endif
static int s_childsig = 0;
#endif // _WINDOWS
#include <unistd.h>
#include <stdlib.h>
@ -332,6 +334,9 @@ bool EngineStatusHandler::received(Message &msg)
msg.retValue() << ",messages=" << Engine::self()->messageCount();
msg.retValue() << ",supervised=" << (s_super_handle >= 0);
msg.retValue() << ",runattempt=" << s_run_attempt;
#ifndef _WINDOWS
msg.retValue() << ",lastsignal=" << s_childsig;
#endif
msg.retValue() << ",threads=" << Thread::count();
msg.retValue() << ",workers=" << EnginePrivate::count;
msg.retValue() << ",mutexes=" << Mutex::count();
@ -819,10 +824,12 @@ static int supervise(void)
s_runagain = false;
else
retcode &= 127;
s_childsig = 0;
}
else if (WIFSIGNALED(status)) {
retcode = WTERMSIG(status);
::fprintf(stderr,"Supervisor: child %d died on signal %d\n",s_childpid,retcode);
s_childsig = retcode;
}
s_childpid = -1;
break;
@ -875,6 +882,7 @@ static int supervise(void)
break;
}
s_childpid = -1;
s_childsig = SIGCHLD;
}
if (s_logrotator) {
copystream(2,logfd[0]);
@ -1080,6 +1088,9 @@ int Engine::run()
s_params.addParam("clientmode",String::boolText(clientMode()));
s_params.addParam("supervised",String::boolText(s_super_handle >= 0));
s_params.addParam("runattempt",String(s_run_attempt));
#ifndef _WINDOWS
s_params.addParam("lastsignal",String(s_childsig));
#endif
s_params.addParam("maxworkers",String(s_maxworkers));
#ifdef _WINDOWS
{