From 628b30208ab8d268ab2fbaae2de7f19443baac27 Mon Sep 17 00:00:00 2001 From: Dag Date: Sat, 23 Nov 2024 22:28:50 +0100 Subject: fix: dont aquire exclusive locks (#4340) Due to bugs in logging/error-handling there sometimes are deadlocks --- caches/FileCache.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'caches/FileCache.php') diff --git a/caches/FileCache.php b/caches/FileCache.php index dfd295e8..ff939bea 100644 --- a/caches/FileCache.php +++ b/caches/FileCache.php @@ -53,7 +53,7 @@ class FileCache implements CacheInterface 'value' => $value, ]; $cacheFile = $this->createCacheFile($key); - $bytes = file_put_contents($cacheFile, serialize($item), LOCK_EX); + $bytes = file_put_contents($cacheFile, serialize($item)); // todo: Consider tightening the permissions of the created file. It usually allow others to read, depending on umask if ($bytes === false) { // Consider just logging the error here -- cgit v1.2.3 From 6a81fc0f519bbf10070b5ae9bffd1adf84f858a6 Mon Sep 17 00:00:00 2001 From: Dag Date: Thu, 28 Nov 2024 03:50:56 +0100 Subject: fix(file_cache): if write failure, produce log record instead of exception (#4352) --- caches/FileCache.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'caches/FileCache.php') diff --git a/caches/FileCache.php b/caches/FileCache.php index ff939bea..24a9872f 100644 --- a/caches/FileCache.php +++ b/caches/FileCache.php @@ -54,10 +54,13 @@ class FileCache implements CacheInterface ]; $cacheFile = $this->createCacheFile($key); $bytes = file_put_contents($cacheFile, serialize($item)); - // todo: Consider tightening the permissions of the created file. It usually allow others to read, depending on umask + + // TODO: Consider tightening the permissions of the created file. + // It usually allow others to read, depending on umask + if ($bytes === false) { - // Consider just logging the error here - throw new \Exception(sprintf('Failed to write to: %s', $cacheFile)); + // Typically means no disk space remaining + $this->logger->warning(sprintf('Failed to write to: %s', $cacheFile)); } } -- cgit v1.2.3