Re: Kannel quits without reporting fatal error
Alan McNatty <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Message-ID | <[email protected]> |
Hello,
run_kannel_box is a strange beast (at least to me). It's purpose seems
unclear (or more appropriately 'undocumented'). I understand it's part
of the utils directory (out of main source) but it is part of standard
build (eg: debian packages).
Andres could you explain a bit about what it's function is .. the man
page is brief. I have yet to review source code in detail - but if it's
supposed to restarting failed services I would be interested in doing
some work/testing with it (potentially adding syslog support to begin
with).
On brief code view I did notice from run_kannel_box source (before
for(;;) in main_loop)
/* We can't report any errors here, because we are running
* as a daemon and we have no logfile of our own. So we
* exit with errno as the exit code, to offer a minimal clue. */
for (;;) {
/* Make sure we don't fork in an endless loop if
something
* is drastically wrong. This code limits it to one
* per minute (or whatever min_restart_delay is set to).
*/
time_t this_time = time(NULL);
if (this_time <= next_fork) {
sleep(next_fork - this_time);
}
next_fork = this_time + min_restart_delay;
child_box = fork();
if (child_box < 0) {
return errno;
}
if (child_box == 0) {
/* child. exec the box */
execvp(boxfile, box_arglist);
exit(127);
}
while (waitpid(child_box, (int *)NULL, 0) != child_box)
{
if (errno == ECHILD) {
/* Something went wrong... we don't know
what,
* but we do know that our child does
not
* exist. So restart it. */
break;
}
if (errno == EINTR) {
continue;
}
/* Something weird happened. */
return errno;
}
}
This seems to suggest potential for 'vanishing' boxes ('soemthing weird
happened' - Stipe does this tie in with your previous comments?). When I
did a process check - there was also no run_kannel_box running.
Cheers,
Alan
On Wed, 2003-07-09 at 01:21, Andreas Fink wrote:
> ehmm.. why you use a bash script for that? Kannel has a nice built in
> feature called
>
>
> run_kannel_box
>
>
> which does exactly that.