#18251: multithreading deadlock in django.models.loading.get_apps
------------------------------+------------------------------------
     Reporter:  harm          |                    Owner:  nobody
         Type:  Bug           |                   Status:  new
    Component:  Core (Other)  |                  Version:  1.3
     Severity:  Normal        |               Resolution:
     Keywords:                |             Triage Stage:  Accepted
    Has patch:  0             |      Needs documentation:  0
  Needs tests:  0             |  Patch needs improvement:  0
Easy pickings:  0             |                    UI/UX:  0
------------------------------+------------------------------------

Comment (by akaariai):

 Good point about the additional work done by get_apps().

 I don't believe self._apps_initialized is needed, a method call which
 returns self.loaded should be light enough. It is hard to imagine a
 situation where one method call is crucial to performance.

 Maybe the best way would be to just make a load() method in apps, which
 returns immediately if already loaded.

 Another way would be to first issue
 [http://docs.python.org/library/imp.html#imp.acquire_lock
 imp.acquire_lock()] before taking the write_lock in app-loading. This
 should probably be done in any case. Although explicitly initializing
 Django's app-state feels right to me.

 I checked the app-loading refactor work (#3591) and it seems it does not
 have any solution to this problem.

 It would be very good to be able to write a test case for this, but it
 seems hard...

-- 
Ticket URL: <https://code.djangoproject.com/ticket/18251#comment:4>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

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

Reply via email to