diff --git a/plugins/python/python_plugin.c b/plugins/python/python_plugin.c index 1acd5716..1e6e965c 100644 --- a/plugins/python/python_plugin.c +++ b/plugins/python/python_plugin.c @@ -1067,7 +1067,9 @@ void uwsgi_python_enable_threads() { up.swap_ts = threaded_swap_ts; up.reset_ts = threaded_reset_ts; } + uwsgi_log("threads support enabled\n"); + } @@ -1078,6 +1080,9 @@ void uwsgi_python_init_thread(int core_id) { pts = PyThreadState_New(up.main_thread->interp); pthread_setspecific(up.upt_save_key, (void *) pts); pthread_setspecific(up.upt_gil_key, (void *) pts); +#ifdef UWSGI_DEBUG + uwsgi_log("pts %d = %p\n", core_id, pts); +#endif } @@ -1354,7 +1359,9 @@ void uwsgi_python_resume(struct wsgi_request *wsgi_req) { void uwsgi_python_fixup() { // set hacky modifier 30 - uwsgi.p[30] = uwsgi.p[0]; + uwsgi.p[30] = uwsgi_malloc( sizeof(struct uwsgi_plugin) ); + memcpy(uwsgi.p[30], uwsgi.p[0], sizeof(struct uwsgi_plugin) ); + uwsgi.p[30]->init_thread = NULL; } void uwsgi_python_hijack(void) { diff --git a/welcome.py b/welcome.py index b3f298c7..78cfefe0 100644 --- a/welcome.py +++ b/welcome.py @@ -1,5 +1,7 @@ import uwsgi import os +import gc +gc.set_debug(gc.DEBUG_SAVEALL) def xsendfile(e, sr): sr('200 OK', [('Content-Type', 'image/png'), ('X-Sendfile', os.path.abspath('logo_uWSGI.png'))]) @@ -27,11 +29,17 @@ routes['/options'] = serve_options def application(env, start_response): + gc.collect(2) + print env['wsgi.input'].fileno() + if routes.has_key(env['PATH_INFO']): return routes[env['PATH_INFO']](env, start_response) start_response('200 OK', [('Content-Type', 'text/html')]) + print env['wsgi.input'].fileno() + gc.collect(2) + return """ version %s