mirror of
https://github.com/clearlinux/uwsgi.git
synced 2026-09-06 05:31:44 +00:00
fixed greenlet memory leaks
This commit is contained in:
@@ -19,18 +19,16 @@ static struct uwsgi_option greenlet_options[] = {
|
||||
struct wsgi_request *uwsgi_greenlet_current_wsgi_req(void) {
|
||||
struct wsgi_request *wsgi_req = NULL;
|
||||
PyObject *current_greenlet = (PyObject *)PyGreenlet_GetCurrent();
|
||||
Py_INCREF(current_greenlet);
|
||||
PyObject *py_wsgi_req = PyObject_GetAttrString(current_greenlet, "uwsgi_wsgi_req");
|
||||
// not in greenlet
|
||||
if (!py_wsgi_req) {
|
||||
uwsgi_log("[BUG] current_wsgi_req NOT FOUND !!!\n");
|
||||
goto end;
|
||||
}
|
||||
Py_INCREF(py_wsgi_req);
|
||||
wsgi_req = (struct wsgi_request*) PyLong_AsLong(py_wsgi_req);
|
||||
//Py_DECREF(py_wsgi_req);
|
||||
Py_DECREF(py_wsgi_req);
|
||||
end:
|
||||
//Py_DECREF(current_greenlet);
|
||||
Py_DECREF(current_greenlet);
|
||||
return wsgi_req;
|
||||
}
|
||||
|
||||
@@ -44,9 +42,11 @@ static void gil_greenlet_release() {
|
||||
|
||||
static PyObject *py_uwsgi_greenlet_request(PyObject * self, PyObject *args) {
|
||||
|
||||
struct wsgi_request *wsgi_req = uwsgi.wsgi_req;
|
||||
|
||||
async_schedule_to_req_green();
|
||||
|
||||
//Py_DECREF(ugl.gl[uwsgi.wsgi_req->async_id]);
|
||||
Py_DECREF(ugl.gl[wsgi_req->async_id]);
|
||||
|
||||
Py_INCREF(Py_None);
|
||||
return Py_None;
|
||||
|
||||
Reference in New Issue
Block a user