Re: Thread-safety bug in WSGIHandler

2009-03-11 Thread Travis Terry
I also found a similar problem in RegexURLResolver. Instances of RegexURLResolver are stored in process memory by using @memoize. The reverse_dict is built on demand, and it doesn't do an atomic assignment, so it creates an incomplete-initialization but as well. I'm new to submitting Django t

Re: Thread-safety bug in WSGIHandler

2009-03-10 Thread Malcolm Tredinnick
On Tue, 2009-03-10 at 10:30 -0400, Travis Terry wrote: [...] > So, my proposed fix is to add a flag in WSGIHandler and then test for > that flag in __call__(). Preferable to construct the list as a local variable and then assign it to the attribute in a single instruction. Assignment is atomic,

Thread-safety bug in WSGIHandler

2009-03-10 Thread Travis Terry
I have found an incomplete-initialization bug the WSGIHandler when running under Apache mpm_worker with mod_wsgi. On the first request the WSGIHandler.__call__(...), we set up the middleware. There is a lock wrapping the load of the middleware, but the logic still allows incomplete initializa