From 96a8b89fa8a82b79bab07674d6464b361cdf0efb Mon Sep 17 00:00:00 2001 From: epriestley Date: Fri, 20 Jul 2018 14:36:07 -0700 Subject: [PATCH] When building a config stack, stop SiteSource objects from poisoning the cache Summary: Ref T13168. I'm not sure how this worked before, but I ran into this issue on my new laptop. SiteSource accesses `PhabrictatorEnv::getEnvConfig('phabricator.base-uri')` when local, which may poison the cache and lock the value since we don't later discard the cache. Specifically, when I access `http://locala.phacility.com`, I was getting an error like "You made a request for locala.phacility.com, but no configured site can serve this request.". This was because the base-uri was being incorrectly frozen as "local.phacility.com". The expectation is that it will match, so the standard PlatformSite will serve the request. Test Plan: - Before change: "no configured site" error. - After change: local instance works properly. Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T13168 Differential Revision: https://secure.phabricator.com/D19526 --- src/infrastructure/env/PhabricatorEnv.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/infrastructure/env/PhabricatorEnv.php b/src/infrastructure/env/PhabricatorEnv.php index ba05d0409d..8b2af38d3d 100644 --- a/src/infrastructure/env/PhabricatorEnv.php +++ b/src/infrastructure/env/PhabricatorEnv.php @@ -221,6 +221,10 @@ final class PhabricatorEnv extends Phobject { foreach ($site_sources as $site_source) { $stack->pushSource($site_source); + + // If the site source did anything which reads config, throw it away + // to make sure any additional site sources get clean reads. + self::dropConfigCache(); } $masters = PhabricatorDatabaseRef::getMasterDatabaseRefs(); @@ -259,6 +263,10 @@ final class PhabricatorEnv extends Phobject { throw $ex; } } + + // Drop the config cache one final time to make sure we're getting clean + // reads now that we've finished building the stack. + self::dropConfigCache(); } public static function repairConfig($key, $value) { -- 2.51.2