From: Thierry Parmentelat Date: Thu, 25 Jul 2013 19:07:39 +0000 (+0200) Subject: fix for WSGI-based PLCAPI, on behalf of Thomas Dreibholz X-Git-Tag: plcapi-5.2-8~1 X-Git-Url: http://git.onelab.eu/?p=plcapi.git;a=commitdiff_plain;h=ad9b3c8054edb60ae4f764bb7bfa12653c06dc99 fix for WSGI-based PLCAPI, on behalf of Thomas Dreibholz --- diff --git a/apache/plc.wsgi b/apache/plc.wsgi index e6a7eb3..c37d369 100644 --- a/apache/plc.wsgi +++ b/apache/plc.wsgi @@ -12,8 +12,6 @@ import traceback from PLC.Debug import log from PLC.API import PLCAPI -api = PLCAPI() - def application(environ, start_response): try: status = '200 OK' @@ -28,6 +26,12 @@ def application(environ, start_response): """ else: + # Thomas Dreibholz + # Note that this function is called within multiple threads! + # "api" MUST be a local variable instead of a global one. + # Otherwise, this causes concurrent accesses to the same + # object within different threads! + api = PLCAPI() api.environ = environ content_type = 'text/xml' ip = environ.get('REMOTE_ADDR')