From 1e26cda61537c5abe927c9c8ed55f4b4e1df0298 Mon Sep 17 00:00:00 2001 From: "roberto@sirius" Date: Mon, 29 Aug 2011 10:30:01 +0200 Subject: [PATCH] fixed a race condition --- plugins/python/python_plugin.c | 1 - spooler.c | 5 +++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/python/python_plugin.c b/plugins/python/python_plugin.c index f9ad31c1..b5d70859 100644 --- a/plugins/python/python_plugin.c +++ b/plugins/python/python_plugin.c @@ -872,7 +872,6 @@ void uwsgi_python_spooler_init(void) { struct uwsgi_string_list *upli = up.spooler_import_list; - UWSGI_GET_GIL while(upli) { diff --git a/spooler.c b/spooler.c index 026252d6..fda05e2f 100644 --- a/spooler.c +++ b/spooler.c @@ -37,6 +37,8 @@ pid_t spooler_start() { signal(SIGUSR1, spooler_wakeup); uwsgi.mywid = -1; uwsgi.mypid = getpid(); + // avoid race conditions !!! + uwsgi.shared->spooler_pid = uwsgi.mypid; uwsgi_close_all_sockets(); if (uwsgi.master_process) { close(uwsgi.shared->spooler_signal_pipe[0]); @@ -66,6 +68,7 @@ pid_t spooler_start() { uwsgi.gp[i]->spooler_init(); } } + spooler(); } else if (pid > 0) { @@ -253,6 +256,8 @@ void spooler() { if (uwsgi.spooler_ordered) { #ifdef __linux__ spooler_scandir(uwsgi.spool_dir); +#else + spooler_readdir(uwsgi.spool_dir); #endif } else {