From f748c022fb6e1a79539a488a35488b45903b63ec Mon Sep 17 00:00:00 2001 From: Dariusz Gafka Date: Thu, 5 Mar 2026 19:59:34 +0000 Subject: [PATCH 1/2] fix: prevent intermittent proxy file missing errors in EcotoneLite tests --- .../src/Messaging/Handler/Gateway/ProxyFactory.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/Ecotone/src/Messaging/Handler/Gateway/ProxyFactory.php b/packages/Ecotone/src/Messaging/Handler/Gateway/ProxyFactory.php index fe95d3ddc..4621f4d02 100644 --- a/packages/Ecotone/src/Messaging/Handler/Gateway/ProxyFactory.php +++ b/packages/Ecotone/src/Messaging/Handler/Gateway/ProxyFactory.php @@ -65,6 +65,10 @@ private function loadProxyClass(GatewayProxyReference $proxyReference): string { if (! self::isLoaded($proxyReference)) { $file = $this->generateCachedProxyFileFor($proxyReference, ! $this->serviceCacheConfiguration->shouldUseCache()); + if (! file_exists($file)) { + clearstatcache(true, $file); + $file = $this->generateCachedProxyFileFor($proxyReference, true); + } require $file; } @@ -116,8 +120,13 @@ private function dumpFile(string $fileName, string $code): void $tmpFileName = $fileName . '.' . bin2hex(random_bytes(12)); - file_put_contents($tmpFileName, $code); + if (file_put_contents($tmpFileName, $code) === false) { + throw ConfigurationException::create("Failed to write proxy cache file {$tmpFileName}"); + } @chmod($tmpFileName, 0664); - rename($tmpFileName, $fileName); + if (rename($tmpFileName, $fileName) === false) { + @unlink($tmpFileName); + throw ConfigurationException::create("Failed to rename proxy cache file from {$tmpFileName} to {$fileName}"); + } } } From 72334e07934f23a3c667900d08f54df4cbe85e74 Mon Sep 17 00:00:00 2001 From: Dariusz Gafka Date: Thu, 5 Mar 2026 20:02:24 +0000 Subject: [PATCH 2/2] fix: remove unnecessary clearstatcache call --- packages/Ecotone/src/Messaging/Handler/Gateway/ProxyFactory.php | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/Ecotone/src/Messaging/Handler/Gateway/ProxyFactory.php b/packages/Ecotone/src/Messaging/Handler/Gateway/ProxyFactory.php index 4621f4d02..1189c4868 100644 --- a/packages/Ecotone/src/Messaging/Handler/Gateway/ProxyFactory.php +++ b/packages/Ecotone/src/Messaging/Handler/Gateway/ProxyFactory.php @@ -66,7 +66,6 @@ private function loadProxyClass(GatewayProxyReference $proxyReference): string if (! self::isLoaded($proxyReference)) { $file = $this->generateCachedProxyFileFor($proxyReference, ! $this->serviceCacheConfiguration->shouldUseCache()); if (! file_exists($file)) { - clearstatcache(true, $file); $file = $this->generateCachedProxyFileFor($proxyReference, true); } require $file;