mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-10-03 15:38:36 +00:00
psgi: Don't free the wsgi_req->async_environ atexit, only in request context
The atexit hooks can be called outside of the request context. See the discussion at https://github.com/unbit/uwsgi/pull/772
This commit is contained in:
@@ -708,6 +708,9 @@ 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) {
|
||||
uwsgi_log("*** psgix.harakiri.commit requested ***\n");
|
||||
@@ -717,9 +720,6 @@ void uwsgi_perl_after_request(struct wsgi_request *wsgi_req) {
|
||||
goodbye_cruel_world();
|
||||
}
|
||||
|
||||
// clear the env
|
||||
SvREFCNT_dec(wsgi_req->async_environ);
|
||||
|
||||
// now we can check for changed files
|
||||
if (uperl.auto_reload) {
|
||||
time_t now = uwsgi_now();
|
||||
@@ -854,7 +854,6 @@ void uwsgi_perl_run_hook(SV *hook) {
|
||||
|
||||
static void uwsgi_perl_atexit() {
|
||||
int i;
|
||||
struct wsgi_request *wsgi_req = current_wsgi_req();
|
||||
|
||||
if (uwsgi.mywid == 0) goto realstuff;
|
||||
|
||||
@@ -876,10 +875,6 @@ destroyperl:
|
||||
for(i=0;i<uwsgi.threads;i++) {
|
||||
PERL_SET_CONTEXT(uperl.main[i]);
|
||||
|
||||
// clear the env, make sure any DESTROY attached to it will
|
||||
// run.
|
||||
SvREFCNT_dec(wsgi_req->async_environ);
|
||||
|
||||
// Destroy the PerlInterpreter, see "perldoc perlembed"
|
||||
perl_destruct(uperl.main[i]);
|
||||
perl_free(uperl.main[i]);
|
||||
|
||||
Reference in New Issue
Block a user