[1.2.X] Fixed #11193 -- WSGI handler not properly handling lock on error in load_middleware. Thanks to Phillip Sitbon.
Backport of [15205] from trunk git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@15206 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
88dfbc50fb
commit
eb9ebb1931
|
@ -225,10 +225,16 @@ class WSGIHandler(base.BaseHandler):
|
|||
# settings weren't available.
|
||||
if self._request_middleware is None:
|
||||
self.initLock.acquire()
|
||||
# Check that middleware is still uninitialised.
|
||||
if self._request_middleware is None:
|
||||
self.load_middleware()
|
||||
self.initLock.release()
|
||||
try:
|
||||
# Check that middleware is still uninitialised.
|
||||
if self._request_middleware is None:
|
||||
self.load_middleware()
|
||||
except:
|
||||
# Unload whatever middleware we got
|
||||
self._request_middleware = None
|
||||
raise
|
||||
finally:
|
||||
self.initLock.release()
|
||||
|
||||
set_script_prefix(base.get_script_name(environ))
|
||||
signals.request_started.send(sender=self.__class__)
|
||||
|
|
Loading…
Reference in New Issue