diff --git a/core/emperor.c b/core/emperor.c index 4b20c28e..e22869fb 100644 --- a/core/emperor.c +++ b/core/emperor.c @@ -2046,7 +2046,6 @@ next: uwsgi.has_emperor = 1; uwsgi.emperor_fd = atoi(emperor_env); uwsgi.master_process = 1; - uwsgi.no_orphans = 1; uwsgi_log("*** has_emperor mode detected (fd: %d) ***\n", uwsgi.emperor_fd); if (getenv("UWSGI_EMPEROR_FD_CONFIG")) { diff --git a/core/uwsgi.c b/core/uwsgi.c index d752e6b8..552c378a 100644 --- a/core/uwsgi.c +++ b/core/uwsgi.c @@ -3144,6 +3144,16 @@ int uwsgi_run() { //from now on the process is a real worker } +#if defined(__linux__) && defined(PR_SET_PDEATHSIG) + // avoid workers running without master at all costs !!! (dangerous) + if (uwsgi.master_process && uwsgi.no_orphans) { + if (prctl(PR_SET_PDEATHSIG, SIGKILL)) { + uwsgi_error("uwsgi_run()/prctl()"); + } + } +#endif + + // eventually maps (or disable) sockets for the worker uwsgi_map_sockets();