Browse Source

Better error message if spawn failed

personal/stbuehler/wip
Stefan Bühler 13 years ago
parent
commit
0087b8cfc2
  1. 16
      src/angel/angel_server.c
  2. 2
      src/common/angel_connection.c

16
src/angel/angel_server.c

@ -120,16 +120,13 @@ static void instance_child_cb(struct ev_loop *loop, ev_child *w, int revents) {
liInstance *i = (liInstance*) w->data;
liInstanceState news;
if (i->s_cur == LI_INSTANCE_DOWN && i->s_dest != LI_INSTANCE_FINISHED) {
ERROR(i->srv, "spawning child %i failed, not restarting", i->proc->child_pid);
news = i->s_dest = LI_INSTANCE_FINISHED; /* TODO: retry spawn later? */
} else if (i->s_dest == LI_INSTANCE_FINISHED) {
if (i->s_dest == LI_INSTANCE_FINISHED) {
if (WIFEXITED(w->rstatus)) {
if (0 != WEXITSTATUS(w->rstatus)) {
ERROR(i->srv, "child %i died with exit status %i", i->proc->child_pid, WEXITSTATUS(w->rstatus));
} /* exit status 0 is ok, no message */
} else if (WIFSIGNALED(w->rstatus)) {
ERROR(i->srv, "child %i died after signal %s", i->proc->child_pid, g_strsignal(WTERMSIG(w->rstatus)));
ERROR(i->srv, "child %i died: killed by %s", i->proc->child_pid, g_strsignal(WTERMSIG(w->rstatus)));
} else {
ERROR(i->srv, "child %i died with unexpected stat_val %i", i->proc->child_pid, w->rstatus);
}
@ -138,11 +135,16 @@ static void instance_child_cb(struct ev_loop *loop, ev_child *w, int revents) {
if (WIFEXITED(w->rstatus)) {
ERROR(i->srv, "child %i died with exit status %i", i->proc->child_pid, WEXITSTATUS(w->rstatus));
} else if (WIFSIGNALED(w->rstatus)) {
ERROR(i->srv, "child %i died after signal %s", i->proc->child_pid, g_strsignal(WTERMSIG(w->rstatus)));
ERROR(i->srv, "child %i died: killed by %s", i->proc->child_pid, g_strsignal(WTERMSIG(w->rstatus)));
} else {
ERROR(i->srv, "child %i died with unexpected stat_val %i", i->proc->child_pid, w->rstatus);
}
news = LI_INSTANCE_DOWN;
if (i->s_cur == LI_INSTANCE_DOWN) {
ERROR(i->srv, "spawning child %i failed, not restarting", i->proc->child_pid);
news = i->s_dest = LI_INSTANCE_FINISHED; /* TODO: retry spawn later? */
} else {
news = LI_INSTANCE_DOWN;
}
}
li_proc_free(i->proc);
i->proc = NULL;

2
src/common/angel_connection.c

@ -151,7 +151,7 @@ static gboolean angel_dispatch(liAngelConnection *acon, GError **err) {
gint32 id = acon->parse.id, type = acon->parse.type;
liAngelCall *call = NULL;
liAngelCallCB cb = NULL;
gpointer ctx;
gpointer ctx = NULL;
switch (type) {
case ANGEL_CALL_SEND_SIMPLE:

Loading…
Cancel
Save