Issue Bug Closed

#91768Race condition while caching data using SimpleFileBackend

Michael Stucki 07/08/20, 18:17 updated 12/02/25, 14:36

Description

When two requests run at the same time:
- request A clears a cache (e.g. cache_core)
- request B tries to write into the same cache

In this situation, request B may fail because the parent folder is gone:

[06-Jul-2020 17:54:02] WARNING: [pool www] child 4978 said into stderr: "NOTICE: PHP message: https://example.host/ - core: Core: Error handler (FE): PHP Warning: file_put_contents(/var/www/html/html/typo3temp/var/Cache/Data/l10n/5f03491aac1d8038441429.temp): failed to open stream: No such file or directory in /var/www/html/vendor/typo3/cms/typo3/sysext/core/Classes/Cache/Backend/SimpleFileBackend.php line 236"
[06-Jul-2020 17:54:02] WARNING: [pool www] child 4978 said into stderr: "NOTICE: PHP message: https://example.host/ - Core: Exception handler (WEB): Uncaught TYPO3 Exception: #1334756737: The temporary cache file "/var/www/html/html/typo3temp/var/Cache/Data/l10n/5f03491aac1d8038441429.temp" could not be written. | TYPO3\CMS\Core\Cache\Exception thrown in file /var/www/html/vendor/typo3/cms/typo3/sysext/core/Classes/Cache/Backend/SimpleFileBackend.php in line 239. Requested URL: https://example.host/home/"

This seems to happen more often on non-local filesystems because they are slower. However, it could also happen when using a local temp folder.

Reviews 3