diff --git a/plugins/psgi/psgi_plugin.c b/plugins/psgi/psgi_plugin.c index a6da23ac..e1c7be96 100644 --- a/plugins/psgi/psgi_plugin.c +++ b/plugins/psgi/psgi_plugin.c @@ -661,32 +661,18 @@ void uwsgi_perl_after_request(struct wsgi_request *wsgi_req) { if (SvTRUE(*harakiri)) wsgi_req->async_plagued = 1; } + // Free the $env hash + SvREFCNT_dec(wsgi_req->async_environ); + // async plagued could be defined in other areas... if (wsgi_req->async_plagued) { - int i; - uwsgi_log("*** psgix.harakiri.commit requested ***\n"); - - // clear the env, make sure any DESTROY attached to it will - // run. - SvREFCNT_dec(wsgi_req->async_environ); - - // We must free our perl context(s) so any DESTROY hooks - // etc. will run. - for(i=0;iasync_environ); - // now we can check for changed files if (uperl.auto_reload) { time_t now = uwsgi_now(); @@ -820,24 +806,34 @@ void uwsgi_perl_run_hook(SV *hook) { } static void uwsgi_perl_atexit() { + int i; + if (uwsgi.mywid == 0) goto realstuff; - // if hijacked do not run atexit hooks + // if hijacked do not run atexit hooks -- TODO: explain why + // not. if (uwsgi.workers[uwsgi.mywid].hijacked) - return; + goto destroyperl; - // if busy do not run atexit hooks - if (uwsgi_worker_is_busy(uwsgi.mywid)) - return; - - // managing atexit in async mode is a real pain...skip it for now - if (uwsgi.async > 1) - return; realstuff: if (uperl.atexit) { uwsgi_perl_run_hook(uperl.atexit); } + +destroyperl: + + // We must free our perl context(s) so any DESTROY hooks + // etc. will run. + for(i=0;i