From c5dd7b71dadf80712c124ebc6f141ced6117b7fe Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Fri, 4 Nov 2016 10:56:34 +0800 Subject: [PATCH] MDL-56748 cache: Removes cache definition instances in purge_store Previously a purge_store was only purging caches but it was leaving a reference to the store instance for the cache definition. As a result, the cache was never cleared away correctly and, in cases where the cache store makes a TCP connection to a backend system, the number of open sockets was increasing for each store instance. After a complete purge, as found in the unit test reset, the cache definitions should be both purged and removed. This change should also lead to a drop in memory consumption for unit tests as there will no longer be references to unused definition stores. --- cache/classes/factory.php | 1 + 1 file changed, 1 insertion(+) diff --git a/cache/classes/factory.php b/cache/classes/factory.php index ac20becfd5f..fc2840bbfed 100644 --- a/cache/classes/factory.php +++ b/cache/classes/factory.php @@ -161,6 +161,7 @@ class cache_factory { $factory->reset_cache_instances(); $factory->configs = array(); $factory->definitions = array(); + $factory->definitionstores = array(); $factory->lockplugins = array(); // MUST be null in order to force its regeneration. // Reset the state to uninitialised. $factory->state = self::STATE_UNINITIALISED;