From 9f2a2973a963179c4434de96bd858a7184ccfadc Mon Sep 17 00:00:00 2001 From: Luke Rodgers Date: Thu, 18 Sep 2025 15:08:01 +0100 Subject: [PATCH 1/5] Add extra debug data to `cache_invalidate` log --- .../Magento/Framework/Cache/InvalidateLogger.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/Cache/InvalidateLogger.php b/lib/internal/Magento/Framework/Cache/InvalidateLogger.php index 08f9930a81b2f..90c2aeaff4538 100644 --- a/lib/internal/Magento/Framework/Cache/InvalidateLogger.php +++ b/lib/internal/Magento/Framework/Cache/InvalidateLogger.php @@ -43,7 +43,15 @@ public function __construct(HttpRequest $request, Logger $logger) */ public function execute($invalidateInfo) { - $this->logger->debug('cache_invalidate: ', $this->makeParams($invalidateInfo)); + $context = $this->makeParams($invalidateInfo); + if (isset($invalidateInfo['tags'], $invalidateInfo['mode'])) { + if ($invalidateInfo['mode'] === 'all' && is_array($invalidateInfo['tags']) && empty($invalidateInfo['tags'])) { + // If we are sending a purge request to all cache storage capture the trace + // This is not a usual flow, and likely a bug is causing a performance issue + $context['trace'] = (new \Exception)->getTrace(); + } + } + $this->logger->debug('cache_invalidate: ', $context); } /** From 2eb2086b48dd71393e138f439552bb0fd95177d9 Mon Sep 17 00:00:00 2001 From: Luke Rodgers Date: Thu, 18 Sep 2025 16:55:17 +0100 Subject: [PATCH 2/5] Fix line length --- lib/internal/Magento/Framework/Cache/InvalidateLogger.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/internal/Magento/Framework/Cache/InvalidateLogger.php b/lib/internal/Magento/Framework/Cache/InvalidateLogger.php index 90c2aeaff4538..7083985b7ac65 100644 --- a/lib/internal/Magento/Framework/Cache/InvalidateLogger.php +++ b/lib/internal/Magento/Framework/Cache/InvalidateLogger.php @@ -45,10 +45,14 @@ public function execute($invalidateInfo) { $context = $this->makeParams($invalidateInfo); if (isset($invalidateInfo['tags'], $invalidateInfo['mode'])) { - if ($invalidateInfo['mode'] === 'all' && is_array($invalidateInfo['tags']) && empty($invalidateInfo['tags'])) { + if ( + $invalidateInfo['mode'] === 'all' + && is_array($invalidateInfo['tags']) + && empty($invalidateInfo['tags']) + ) { // If we are sending a purge request to all cache storage capture the trace // This is not a usual flow, and likely a bug is causing a performance issue - $context['trace'] = (new \Exception)->getTrace(); + $context['trace'] = (new \Exception)->getTrace(); } } $this->logger->debug('cache_invalidate: ', $context); From ba810477fddde093ee0c19ab54ab5031fb78d4a1 Mon Sep 17 00:00:00 2001 From: Luke Rodgers Date: Thu, 18 Sep 2025 16:57:04 +0100 Subject: [PATCH 3/5] Update copyright header https://public-results-storage-prod.magento-testing-service.engineering/reports/magento/magento2/pull/40196/0b62a7b8683ef732e82264c00c926c60/Statics/report-sanity-ee.html ``` /** * Copyright {{CREATION_YEAR}} Adobe * All Rights Reserved. */ ``` --- lib/internal/Magento/Framework/Cache/InvalidateLogger.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/internal/Magento/Framework/Cache/InvalidateLogger.php b/lib/internal/Magento/Framework/Cache/InvalidateLogger.php index 7083985b7ac65..eaca045b46be8 100644 --- a/lib/internal/Magento/Framework/Cache/InvalidateLogger.php +++ b/lib/internal/Magento/Framework/Cache/InvalidateLogger.php @@ -1,9 +1,7 @@ Date: Sun, 5 Oct 2025 17:18:49 +0100 Subject: [PATCH 4/5] Update InvalidateLogger.php See https://github.com/magento/magento2/pull/40196#discussion_r2360022200 --- lib/internal/Magento/Framework/Cache/InvalidateLogger.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/Cache/InvalidateLogger.php b/lib/internal/Magento/Framework/Cache/InvalidateLogger.php index eaca045b46be8..e659c616a1c48 100644 --- a/lib/internal/Magento/Framework/Cache/InvalidateLogger.php +++ b/lib/internal/Magento/Framework/Cache/InvalidateLogger.php @@ -50,7 +50,7 @@ public function execute($invalidateInfo) ) { // If we are sending a purge request to all cache storage capture the trace // This is not a usual flow, and likely a bug is causing a performance issue - $context['trace'] = (new \Exception)->getTrace(); + $context['trace'] = (string)(new \Exception('full purge of cache storage triggered')); } } $this->logger->debug('cache_invalidate: ', $context); From 0b27837dc3697a6c0773b4300f77ee90f542fd96 Mon Sep 17 00:00:00 2001 From: Luke Rodgers Date: Sun, 5 Oct 2025 18:20:05 +0100 Subject: [PATCH 5/5] Update InvalidateLogger.php --- lib/internal/Magento/Framework/Cache/InvalidateLogger.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/internal/Magento/Framework/Cache/InvalidateLogger.php b/lib/internal/Magento/Framework/Cache/InvalidateLogger.php index e659c616a1c48..5ae98e49de3fb 100644 --- a/lib/internal/Magento/Framework/Cache/InvalidateLogger.php +++ b/lib/internal/Magento/Framework/Cache/InvalidateLogger.php @@ -43,8 +43,7 @@ public function execute($invalidateInfo) { $context = $this->makeParams($invalidateInfo); if (isset($invalidateInfo['tags'], $invalidateInfo['mode'])) { - if ( - $invalidateInfo['mode'] === 'all' + if ($invalidateInfo['mode'] === 'all' && is_array($invalidateInfo['tags']) && empty($invalidateInfo['tags']) ) {