2538: Djblets: memcached leakage across instances - when instances run same server domain but different site root
- Fixed
- Review Board
| eric%ti*******@gtempacc******** (Google Code) (Is this you? Claim this profile.) | |
| Sept. 28, 2012 |
As per this email thread: http://groups.google.com/group/reviewboard/browse_thread/thread/2f6b51a052271624# I've noticed some "cache leakage" from one reviewboard instance. I host multiple reviewboard instances on one server, and they all share the same domain name for the host, but different "SITE_ROOT"s.
I believe the following patch does the job of fixing this issue against the Djblets project:
diff --git a/djblets/util/misc.py b/djblets/util/misc.py
index 5fb8da8..521bfab 100644
--- a/djblets/util/misc.py
+++ b/djblets/util/misc.py
@@ -193,7 +193,12 @@ def make_cache_key(key):
site = Site.objects.get_current()
# The install has a Site app, so prefix the domain to the key.
- key = "%s:%s" % (site.domain, key)
+ # Also prefix the site root, if there is one, to allow for
+ # multiple instances on the same host.
+ if settings.SITE_ROOT:
+ key = "%s:%s:%s" % (site.domain, settings.SITE_ROOT, key)
+ else:
+ key = "%s:%s" % (site.domain, key)
except:
# The install doesn't have a Site app, so use the key as-is.
pass