cherrypy.serving.request and cherrypy.serving.response not thread safe by default ?
I am using cherrypy 3.2.0 to dispatch requests to my own WSGI
applications. I am not at all an expert in cherrypy.
in cherrpy/__init__.py :
The threadlocal _Serving object's docstring says that it's a
threadlocal container for request and response. However, on
instantiation of this _Serving object (at serving = _Serving() ),
request and response seem to be set to class variables (e.g. one
request for all instances of the _Serving() object)
It seems that this object is not directly threadsafe, for example :
for t in xrange(10):
will return always the same id.
What I think is happening is that the first call to load(request,
response) effectively sets self.response and self.request (and not
_Serving.request and _Serving.response) and makes it threadsafe.
I think the code might be clearer and more roboust with :