Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[1.2.X] Fixed #11193 -- WSGI handler not properly handling lock on er…

…ror 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
  • Loading branch information...
commit eb9ebb1931de3b41b7cfe9b48e1f7bfa506d3c4e 1 parent 88dfbc5
@andrewgodwin andrewgodwin authored
Showing with 10 additions and 4 deletions.
  1. +10 −4 django/core/handlers/wsgi.py
View
14 django/core/handlers/wsgi.py
@@ -225,10 +225,16 @@ def __call__(self, environ, start_response):
# 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__)
Please sign in to comment.
Something went wrong with that request. Please try again.