Project

General

Profile

Actions

Task #88927

open

The temporary cache file ... could not be written

Added by Christoph Lehmann over 3 years ago. Updated almost 3 years ago.

Status:
Needs Feedback
Priority:
Should have
Assignee:
-
Category:
Caching
Target version:
-
Start date:
2019-08-06
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

TYPO3\CMS\Core\Cache\Exception: The temporary cache file "/var/www/.../typo3temp/var/Cache/Code/cache_core/5d499dd925221994946712.temp" could not be written.
  File "typo3_src-8.7.27/typo3/sysext/core/Classes/Cache/Backend/SimpleFileBackend.php", line 233, in set
    throw new \TYPO3\CMS\Core\Cache\Exception('The temporary cache file "' . $temporaryCacheEntryPathAndFilename . '" could not be written.', 1334756737);
  File "typo3_src-8.7.27/typo3/sysext/core/Classes/Cache/Frontend/PhpFrontend.php", line 64, in set
    $this->backend->set($entryIdentifier, $sourceCode, $tags, $lifetime);
  File "typo3_src-8.7.27/typo3/sysext/core/Classes/Utility/ExtensionManagementUtility.php", line 1822, in createBaseTcaCacheFile
    . ';'
  File "typo3_src-8.7.27/typo3/sysext/core/Classes/Utility/ExtensionManagementUtility.php", line 1710, in loadBaseTca
    static::createBaseTcaCacheFile();
  File "typo3_src-8.7.27/typo3/sysext/core/Classes/Core/Bootstrap.php", line 966, in loadBaseTca
    ExtensionManagementUtility::loadBaseTca($allowCaching);
...
(6 additional frame(s) were not displayed)

It may be a race condition due to parallel requests and should be handle more friendly: "Okay, a temporary error, but go on"


Related issues 2 (1 open1 closed)

Related to TYPO3 Core - Story #81432: Replace TYPO3 caching solution with PSR-6 / Doctrine capable alternativeClosed2017-06-02

Actions
Related to TYPO3 Core - Bug #91768: Race condition while caching data using SimpleFileBackendNew2020-07-08

Actions
Actions #1

Updated by Christoph Lehmann over 3 years ago

  • Related to Story #81432: Replace TYPO3 caching solution with PSR-6 / Doctrine capable alternative added
Actions #2

Updated by Susanne Moog almost 3 years ago

  • Status changed from New to Needs Feedback

When does this happen / is there a way to reproduce it?

In addition: it might be a temporary error or a deeper problem, we have currently no way to differentiate the two.

Actions #3

Updated by Martin Schulz almost 3 years ago

When does this happen / is there a way to reproduce it?

  1. Start a long runing script that uses a SimpleFileBackend cache
  2. Clear the file cache by flushing the /cache dir

In my case the long runing scipt is an importer script using some parts of extbase. So the cache in that case would be the extbase reflection cache.

So when is the cache flushed as described above?

I found the follwing 2, but there might be more:

The problem is, that the cache file/directory to use is only initializes once. So if the file/dir is deleted (by an other script) during a long runing script, writing the cache will crash.

Actions #4

Updated by Alexander Vogt almost 3 years ago

The error occurs after the "flushDirectory" call:
https://github.com/TYPO3/TYPO3.CMS/blob/9.5/typo3/sysext/install/Classes/Service/ClearCacheService.php#L44

After that the specific cache directory (e.g. var/cache/data/extbase_reflection) will be deleted and this leads to the exception:
https://github.com/TYPO3/TYPO3.CMS/blob/9.5/typo3/sysext/core/Classes/Cache/Backend/SimpleFileBackend.php#L231

The directory will only be recreated on cache initialization:
https://github.com/TYPO3/TYPO3.CMS/blob/9.5/typo3/sysext/core/Classes/Cache/Backend/SimpleFileBackend.php#L91

Actions #5

Updated by Christoph Lehmann almost 3 years ago

For me it happens for requests while switching a symlinked document root.

Actions #6

Updated by Mathias Brodala over 2 years ago

  • Related to Bug #91768: Race condition while caching data using SimpleFileBackend added
Actions

Also available in: Atom PDF