diff --git a/core/gateway.c b/core/gateway.c index a9c72db1..af0b4ee3 100644 --- a/core/gateway.c +++ b/core/gateway.c @@ -41,6 +41,10 @@ struct uwsgi_gateway *register_gateway(char *name, void (*loop) (int, void *), v return ug; } +static void gateway_brutal_end() { + _exit(UWSGI_END_CODE); +} + void gateway_respawn(int id) { pid_t gw_pid; @@ -65,6 +69,7 @@ void gateway_respawn(int id) { } #endif uwsgi.mypid = getpid(); + atexit(gateway_brutal_end); signal(SIGALRM, SIG_IGN); signal(SIGHUP, SIG_IGN); signal(SIGINT, end_me); @@ -77,7 +82,7 @@ void gateway_respawn(int id) { ug->loop(id, ug->data); // never here !!! (i hope) - exit(1); + _exit(1); } ug->pid = gw_pid; diff --git a/plugins/corerouter/corerouter.c b/plugins/corerouter/corerouter.c index 75db862e..9e617e43 100644 --- a/plugins/corerouter/corerouter.c +++ b/plugins/corerouter/corerouter.c @@ -834,23 +834,7 @@ void uwsgi_corerouter_loop(int id, void *data) { } // not having a hook could mean a previous event in the loop cleared it... - if (!hook) { - // a single event cannot be unexpected.. - if (nevents == 1) { - if (interesting_fd == cr_session->instance_fd) { - uwsgi_log("[uwsgi-corerouter] BUG, unexpected event received from backend instance (fd: %d nevents: %d) !!!\n", interesting_fd, nevents); - } - else if (interesting_fd == cr_session->fd) { - uwsgi_log("[uwsgi-corerouter] BUG, unexpected event received from client (fd: %d nevents: %d)!!!\n", interesting_fd, nevents); - } - else { - uwsgi_log("[uwsgi-corerouter] BUG, unexpected event received !!!\n"); - } - corerouter_close_session(ucr, cr_session); - } - continue; - } - + if (!hook) continue; // reset errno (as we use it for internal signalling) errno = 0; ssize_t ret = hook(cr_session);