|Version 9 (modified by 9 years ago) (diff),|
Part of DjangoSpecifications
Threading improvements in Django
According to tickets #5632, #6950 and discussions http://groups.google.com/group/django-users/browse_frm/thread/a7d42475b66530bd, http://groups.google.com/group/django-developers/browse_thread/thread/fbcfa88c997d1bb3, at least the following components of Django are not entirely thread-safe:
This specification outlines the changes that need to be implemented to solve these issues.
A related task is to identify other components not mentioned here that have threading issues.
See #1442 and http://groups.google.com/group/django-developers/browse_thread/thread/905f79e350525c95 for threading discussions.
There are three types of globals:
- read-only globals that are never assigned to (THREAD-SAFE),
- globals assigned to in a function by using the
globalkeyword (NOT THREAD-SAFE),
- global mutable data structures (lists and dictionaries, also instances) that are assigned to at module level but whose elements are modified in functions and that are accessed without using the
globalkeyword (NOT THREAD-SAFE unless never modified).
We won't deal with read-only globals.
grep in Django source finds the following other globals.
Globals accessed with the
$ grep -r '^[[:space:]]*global ' django/ | egrep -v '(\.svn|\.html|\.css|\.pyc|doctest)' | sort | uniq
yields the following results
django/contrib/sites/models.py: global SITE_CACHE django/core/management/__init__.py: global _commands django/template/context.py: global _standard_context_processors django/template/__init__.py: global invalid_var_format_string django/template/loader.py: global template_source_loaders django/utils/translation/trans_real.py: global _accepted django/utils/translation/trans_real.py: global _active django/utils/translation/trans_real.py: global _default, _active django/utils/translation/trans_real.py: global _translations django/utils/translation/trans_real.py: global _translations