#17303: Cached template loader can fail to find template in multi-threaded environment -------------------------------------+------------------------------------- Reporter: andrey.gtx@… | Owner: nobody Type: Bug | Status: new Component: Template system | Version: SVN Severity: Normal | Resolution: Keywords: | Triage Stage: Ready for Has patch: 1 | checkin Needs tests: 0 | Needs documentation: 0 Easy pickings: 0 | Patch needs improvement: 0 | UI/UX: 0 -------------------------------------+------------------------------------- Changes (by akaariai):
* stage: Accepted => Ready for checkin Comment: I added a comment in the patch, and made the patch apply to root directory. I think this is ready for checkin, although the committer might want to check the added comment. My English is what it is... I tried to make the loaders property a cached_property. This would work fine, but tests use the _cached_loaders variable, and I do not have the time to fix the tests. This would be a good thing to fix, but I just don't have time to do that currently. Tests are effectively dependent on the implementation details of cached template loader, but they could almost as easily use the Loader.`__init__` to pass the wanted loaders. I also checked what it would take to write a test for the concurrency issue. This would require a dummy template loader. Add it as a second loader for the cached loader. Then (using a semaphore, for example) make two threads access the loaders() property with proper timing, so that the first thread has loaded just one template loader when the second thread access the loaders() property... In short: doable, but not worth the effort IMHO. The added comment should be guard enough against regressions. All tests passed on sqlite3. -- Ticket URL: <https://code.djangoproject.com/ticket/17303#comment:2> 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 django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.