← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1672133] [NEW] local-memory cache backend of Django session backend can't pass session data after logining

 

Public bug reported:

the browser remained in the login page after login with right user and password, when I change backend session engine from mysql to local-memory cache. I inspect the code, and found this code: 
in .../django/core/cache/__init__.py
class CacheHandler(object):
      
    def __init__(self):
        self._caches = local()

    def __getitem__(self, alias):

        try:
            return self._caches.caches[alias]
        except AttributeError:
            self._caches.caches = {}
        except KeyError:
            getitemp("no caches.caches.caches key in cache handler getitem, ")
            pass

        if alias not in settings.CACHES:
            raise InvalidCacheBackendError(
                "Could not find config for '%s' in settings.CACHES" % alias
            )
        cache = _create_cache(alias)
        self._caches.caches[alias] = cache
        return cache
    def all(self):
        return getattr(self._caches, 'caches', {}).values()

caches = CacheHandler()

in Login view, the user has autenticated, and the session info has been recorded in caches._caches.caches[alias],
but when browser re-targets to project view, the backend is a new process with new caches(),so 
except AttributeError:
            self._caches.caches = {}
no old session data in it, the view return to login page again.
Is this a bug? or a Django bug? 
thanks.

** Affects: horizon
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to OpenStack Dashboard (Horizon).
https://bugs.launchpad.net/bugs/1672133

Title:
  local-memory cache backend of Django session backend can't pass
  session data after logining

Status in OpenStack Dashboard (Horizon):
  New

Bug description:
  the browser remained in the login page after login with right user and password, when I change backend session engine from mysql to local-memory cache. I inspect the code, and found this code: 
  in .../django/core/cache/__init__.py
  class CacheHandler(object):
        
      def __init__(self):
          self._caches = local()

      def __getitem__(self, alias):

          try:
              return self._caches.caches[alias]
          except AttributeError:
              self._caches.caches = {}
          except KeyError:
              getitemp("no caches.caches.caches key in cache handler getitem, ")
              pass

          if alias not in settings.CACHES:
              raise InvalidCacheBackendError(
                  "Could not find config for '%s' in settings.CACHES" % alias
              )
          cache = _create_cache(alias)
          self._caches.caches[alias] = cache
          return cache
      def all(self):
          return getattr(self._caches, 'caches', {}).values()

  caches = CacheHandler()

  in Login view, the user has autenticated, and the session info has been recorded in caches._caches.caches[alias],
  but when browser re-targets to project view, the backend is a new process with new caches(),so 
  except AttributeError:
              self._caches.caches = {}
  no old session data in it, the view return to login page again.
  Is this a bug? or a Django bug? 
  thanks.

To manage notifications about this bug go to:
https://bugs.launchpad.net/horizon/+bug/1672133/+subscriptions


Follow ups