From 9bd3022a5ee120c5f45755058edaca4c55e215f0 Mon Sep 17 00:00:00 2001 From: "roberto@debian32" Date: Thu, 4 Aug 2011 14:11:40 +0200 Subject: [PATCH] a bunch of threading fixes in the spooler --- plugins/python/python_plugin.c | 6 +++++- spooler.c | 1 - 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/plugins/python/python_plugin.c b/plugins/python/python_plugin.c index 8b15c25c..cbac0a9a 100644 --- a/plugins/python/python_plugin.c +++ b/plugins/python/python_plugin.c @@ -826,6 +826,8 @@ char *uwsgi_pythonize(char *orig) { void uwsgi_python_spooler_init(void) { struct uwsgi_string_list *upli = up.spooler_import_list; + + UWSGI_GET_GIL while(upli) { if (strchr(upli->value, '/') || uwsgi_endswith(upli->value, ".py")) { uwsgi_pyimport_by_filename(uwsgi_pythonize(upli->value), upli->value); @@ -837,6 +839,7 @@ void uwsgi_python_spooler_init(void) { } upli = upli->next; } + UWSGI_RELEASE_GIL } @@ -1206,8 +1209,9 @@ int uwsgi_python_spooler(char *filename, char *buf, uint16_t len, char *body, si PyDict_SetItemString(spool_dict, "body", PyString_FromStringAndSize(body, body_len)); } PyTuple_SetItem(pyargs, 0, spool_dict); - + ret = python_call(spool_func, pyargs, 0); + if (ret) { if (!PyInt_Check(ret)) { // error, retry diff --git a/spooler.c b/spooler.c index 786337a7..a66fd002 100644 --- a/spooler.c +++ b/spooler.c @@ -437,7 +437,6 @@ int uwsgi_request_spooler(struct wsgi_request *wsgi_req) { return -1; } - uwsgi_log("managing spool request...\n"); i = spool_request(spool_filename, uwsgi.workers[0].requests + 1, wsgi_req->async_id, wsgi_req->buffer, wsgi_req->uh.pktsize, NULL, 0, NULL, 0); wsgi_req->uh.modifier1 = 255; wsgi_req->uh.pktsize = 0;