From 34a085d3bf6c9bd97e9f882d458a11301c3f44ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20M=C3=BCller?= Date: Sun, 28 Sep 2025 17:35:33 +0200 Subject: [PATCH] fix(cache): Ensure unique global prefix per instanceid MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marcel Müller --- lib/private/Memcache/Factory.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/private/Memcache/Factory.php b/lib/private/Memcache/Factory.php index 0ed6a440a5d..a2681be21c2 100644 --- a/lib/private/Memcache/Factory.php +++ b/lib/private/Memcache/Factory.php @@ -119,7 +119,10 @@ class Factory implements ICacheFactory { $versions = $appConfig->getAppInstalledVersions(); } $versions['core'] = implode('.', $this->serverVersion->getVersion()); - $this->globalPrefix = hash('xxh128', implode(',', $versions)); + + // Include instanceid in the prefix, in case multiple instances use the same cache (e.g. same FPM pool) + $instanceid = $config->getValue('instanceid'); + $this->globalPrefix = hash('xxh128', $instanceid . implode(',', $versions)); } return $this->globalPrefix; } @@ -132,7 +135,10 @@ class Factory implements ICacheFactory { */ public function withServerVersionPrefix(\Closure $closure): void { $backupPrefix = $this->globalPrefix; - $this->globalPrefix = hash('xxh128', implode('.', $this->serverVersion->getVersion())); + + // Include instanceid in the prefix, in case multiple instances use the same cache (e.g. same FPM pool) + $instanceid = \OCP\Server::get(SystemConfig::class)->getValue('instanceid'); + $this->globalPrefix = hash('xxh128', $instanceid . implode('.', $this->serverVersion->getVersion())); $closure($this); $this->globalPrefix = $backupPrefix; }