Project

General

Profile

Actions

Bug #57136

closed

Mitigate race condition when clearing file caches

Added by Helmut Hummel about 10 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
-
Target version:
Start date:
2014-03-21
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
6.2
PHP Version:
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

When file caches are flushed, the cache directory is also deleted.

Now when a second request comes in and creates the caches
it happens that the cache directory of a given cache is still there
for this cache when calling setCache in the SimpleFileBackend,
but is deleted by the first request afterwards.

Now the cache directory for the second request does not exist
and setting cache entries will fail.

Debug trace of the two requests:

[21-Mar-2014 10:50:14 Europe/Berlin] 532c0b566855e setCache
[21-Mar-2014 10:50:14 Europe/Berlin] 532c0b566855e setCache
[21-Mar-2014 10:50:14 Europe/Berlin] 532c0b5674733 setCache
[21-Mar-2014 10:50:14 Europe/Berlin] 532c0b5674733 setCache
[21-Mar-2014 10:50:14 Europe/Berlin] 532c0b566855e setCache
[21-Mar-2014 10:50:14 Europe/Berlin] 532c0b5674733 setCache
[21-Mar-2014 10:50:14 Europe/Berlin] 532c0b566855e setCache
[21-Mar-2014 10:50:14 Europe/Berlin] 532c0b566855e setCache
[21-Mar-2014 10:50:14 Europe/Berlin] 532c0b566855e setCache
[21-Mar-2014 10:50:14 Europe/Berlin] 532c0b566855e flush /htdocs/master/typo3temp/Cache/Code/cache_core/
[21-Mar-2014 10:50:14 Europe/Berlin] 532c0b566855e create /htdocs/master/typo3temp/Cache/Code/cache_core/
[21-Mar-2014 10:50:14 Europe/Berlin] 532c0b566855e flush /htdocs/master/typo3temp/Cache/Data/cache_classes/
[21-Mar-2014 10:50:14 Europe/Berlin] 532c0b5674733 exception 
[21-Mar-2014 10:50:14 Europe/Berlin] 532c0b5674733 exception 
[21-Mar-2014 10:50:14 Europe/Berlin] PHP Fatal error:  Uncaught exception 'TYPO3\CMS\Core\Error\Exception' with message 'PHP Warning: file_put_contents(/htdocs/master/typo3temp/Cache/Data/cache_classes/532c0b56e0596.temp): failed to open stream: No such file or directory in /TYPO3/master/typo3/sysext/core/Classes/Cache/Backend/SimpleFileBackend.php line 246' in /TYPO3/master/typo3/sysext/core/Classes/Error/ErrorHandler.php:111
Stack trace:
#0 [internal function]: TYPO3\CMS\Core\Error\ErrorHandler->handleError(2, 'file_put_conten...', '/Volumes/Data/U...', 246, Array)
#1 /TYPO3/master/typo3/sysext/core/Classes/Cache/Backend/SimpleFileBackend.php(246): file_put_contents('/Volumes/Data/U...', '/Volumes/Data/U...')
#2 /TYPO3/master/typo3/sysext/core/Classes/Cache/Frontend/StringFrontend.php(60): TYPO3\CMS\Core\Cache\Backend\SimpleFileBackend->set('typo3_cms_core_...', '/Volumes/Data/U...', Arra in /TYPO3/master/typo3/sysext/core/Classes/Error/ErrorHandler.php on line 111
[21-Mar-2014 10:50:15 Europe/Berlin] 532c0b566855e create /htdocs/master/typo3temp/Cache/Data/cache_classes/
[21-Mar-2014 10:50:15 Europe/Berlin] 532c0b566855e flush /htdocs/master/typo3temp/Cache/Data/l10n/
[21-Mar-2014 10:50:15 Europe/Berlin] 532c0b566855e create /htdocs/master/typo3temp/Cache/Data/l10n/
[21-Mar-2014 10:50:15 Europe/Berlin] 532c0b566855e flush /htdocs/master/typo3temp/Cache/Code/cache_phpcode/
[21-Mar-2014 10:50:15 Europe/Berlin] 532c0b566855e create /htdocs/master/typo3temp/Cache/Code/cache_phpcode/
[21-Mar-2014 10:50:15 Europe/Berlin] 532c0b566855e flush /htdocs/master/typo3temp/Cache/Code/fluid_template/
[21-Mar-2014 10:50:15 Europe/Berlin] 532c0b566855e create /htdocs/master/typo3temp/Cache/Code/fluid_template/

Mitigate this by immediately recreating the cache directory


Files

debug-race-condition.diff (3.6 KB) debug-race-condition.diff Helmut Hummel, 2014-03-21 11:04
slow-down-flush.diff (546 Bytes) slow-down-flush.diff Helmut Hummel, 2014-03-21 12:58
Actions #1

Updated by Helmut Hummel about 10 years ago

  • File debug-race-condition.diff added
Actions #2

Updated by Helmut Hummel about 10 years ago

  • File deleted (debug-race-condition.diff)
Actions #4

Updated by Gerrit Code Review about 10 years ago

  • Status changed from New to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/28594

Actions #6

Updated by Helmut Hummel about 10 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #7

Updated by Riccardo De Contardi over 6 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF