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 tickets, so this is what I did:

I have created tickets #10470 and #10472 for the threadsafe problems in 
BaseHandler and RegexURLResolver respectively.  I accept both tickets 
and attached patches to each.  Tests are really not possible because 
testing requires heavy load and a multi-threaded server, neither of 
which are available in the current testing framework.  I left the Triage 
Stage at Unreviewed because I didn't know if discussing the problem in 
the developers list counted as review or if you or someone else needed 
to review them.

Let me know if there is anything else I can do to help get these committed.

Travis
Propeller.com


Malcolm Tredinnick wrote:
> 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, so the
> attribute will either be populated or not in that case and can act as
> its own flag. Avoids adding yet another variable and matches what we do
> in a bunch of other places. Apart from that your analysis looks correct.
>
> Please open a ticket in Django's Trac do that this doesn't get
> forgotten.
>
> Regards,
> Malcolm
>
>
>
> >
>
>
>   

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to