From 39706c5899f3b6d770e4f9864dfff7dc47ba7dab Mon Sep 17 00:00:00 2001 From: Unbit Date: Tue, 26 Aug 2014 07:25:25 +0200 Subject: [PATCH] fixed #693 --- core/utils.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/core/utils.c b/core/utils.c index a154c38c..8dd07275 100644 --- a/core/utils.c +++ b/core/utils.c @@ -1022,7 +1022,11 @@ void uwsgi_destroy_request(struct wsgi_request *wsgi_req) { // reset for avoiding following requests to fail on non-uwsgi protocols // thanks Marko Tiikkaja for catching it wsgi_req->uh->pktsize = 0; + + // some plugins expected async_id to be defined before setup + int tmp_id = wsgi_req->async_id; memset(wsgi_req, 0, sizeof(struct wsgi_request)); + wsgi_req->async_id = tmp_id; } // finalize/close/free a request @@ -1168,9 +1172,10 @@ void uwsgi_close_request(struct wsgi_request *wsgi_req) { wsgi_req->uh->pktsize = 0; tmp_id = wsgi_req->async_id; memset(wsgi_req, 0, sizeof(struct wsgi_request)); - + // some plugins expected async_id to be defined before setup + wsgi_req->async_id = tmp_id; // yes, this is pretty useless but we cannot ensure all of the plugin have the same behaviour - uwsgi.workers[uwsgi.mywid].cores[tmp_id].in_request = 0; + uwsgi.workers[uwsgi.mywid].cores[wsgi_req->async_id].in_request = 0; if (uwsgi.max_requests > 0 && uwsgi.workers[uwsgi.mywid].delta_requests >= uwsgi.max_requests && (end_of_request - (uwsgi.workers[uwsgi.mywid].last_spawn * 1000000) >= uwsgi.min_worker_lifetime * 1000000)) {