diff --git a/master.c b/master.c index ef93b7ae..05489c4b 100644 --- a/master.c +++ b/master.c @@ -1052,7 +1052,9 @@ void master_loop(char **argv, char **environ) { } - uwsgi_log( "DAMN ! process %d died :( trying respawn ...\n", diedpid); + if (uwsgi.workers[uwsgi.mywid].manage_next_request) { + uwsgi_log( "DAMN ! worker %d (pid: %d) died :( trying respawn ...\n", uwsgi.mywid, (int)diedpid); + } gettimeofday(&last_respawn, NULL); if (last_respawn.tv_sec == uwsgi.respawn_delta) { uwsgi_log( "worker respawning too fast !!! i have to sleep a bit...\n"); @@ -1087,28 +1089,9 @@ void master_loop(char **argv, char **environ) { uwsgi_error("fork()"); } else { - uwsgi_log( "Respawned uWSGI worker (new pid: %d)\n", pid); - //close(uwsgi.workers[uwsgi.mywid].pipe[1]); - //event_queue_add_fd_read(uwsgi.master_queue, uwsgi.workers[uwsgi.mywid].pipe[0]); -#ifdef UWSGI_SPOOLER - if (uwsgi.mywid <= 0 && diedpid != uwsgi.shared->spooler_pid) { -#else - if (uwsgi.mywid <= 0) { -#endif - -#ifdef UWSGI_PROXY - // TODO if no gateway span the error !!! - if (diedpid != uwsgi.shared->proxy_pid) { -#endif - uwsgi_log( "warning the died pid was not in the workers list. Probably you hit a BUG of uWSGI\n"); -#ifdef UWSGI_PROXY - } -#endif - } - } - } - - + uwsgi_log( "Respawned uWSGI worker %d (new pid: %d)\n", uwsgi.mywid, (int) pid); } } +} +} diff --git a/plugins/python/pyloader.c b/plugins/python/pyloader.c index 7a5a4785..75760de7 100644 --- a/plugins/python/pyloader.c +++ b/plugins/python/pyloader.c @@ -149,6 +149,14 @@ int init_uwsgi_app(int loader, void *arg1, struct wsgi_request *wsgi_req, PyThre wi->interpreter = up.main_thread; } + if (wsgi_req->touch_reload_len) { + struct stat trst; + char *touch_reload = uwsgi_strncopy(wsgi_req->touch_reload, wsgi_req->touch_reload_len); + if (!stat(touch_reload, &trst)) { + wi->touch_reload = touch_reload; + wi->touch_reload_mtime = trst.st_mtime; + } + } wi->callable = up.loaders[loader](arg1); diff --git a/protocol.c b/protocol.c index 45e02c55..1b9f3cc4 100644 --- a/protocol.c +++ b/protocol.c @@ -516,6 +516,14 @@ int uwsgi_parse_vars(struct wsgi_request *wsgi_req) { wsgi_req->chdir = ptrbuf; wsgi_req->chdir_len = strsize; } + else if (!uwsgi_strncmp("UWSGI_FILE", 10, wsgi_req->hvec[wsgi_req->var_cnt].iov_base, wsgi_req->hvec[wsgi_req->var_cnt].iov_len)) { + wsgi_req->file = ptrbuf; + wsgi_req->file_len = strsize; + } + else if (!uwsgi_strncmp("UWSGI_TOUCH_RELOAD", 18, wsgi_req->hvec[wsgi_req->var_cnt].iov_base, wsgi_req->hvec[wsgi_req->var_cnt].iov_len)) { + wsgi_req->touch_reload = ptrbuf; + wsgi_req->touch_reload_len = strsize; + } else if (!uwsgi_strncmp("UWSGI_SETENV", 12, wsgi_req->hvec[wsgi_req->var_cnt].iov_base, wsgi_req->hvec[wsgi_req->var_cnt].iov_len)) { char *env_value = memchr(ptrbuf, '=', strsize); if (env_value) { diff --git a/utils.c b/utils.c index 677655c2..e89a0c4e 100644 --- a/utils.c +++ b/utils.c @@ -941,6 +941,7 @@ char *uwsgi_strncopy(char *s, int len) { int uwsgi_get_app_id(char *script_name, int script_name_len, int modifier1) { int i; + struct stat st; for(i=0;i