Bug #55099

PHP Warnings after clearing configuration cache in BE

Added by Markus Klein almost 6 years ago. Updated about 1 year ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Backend API
Target version:
Start date:
2014-01-17
Due date:
% Done:

100%

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

Description

Steps to reproduce
  1. rm -rf typo3temp/*
  2. Open BE, Page module
  3. Click on some random page in the tree
  4. Clear the configuration cache via toolbar icon
  5. Click on some page again in the tree

An extdirect exception popups at the bottom of the BE

Warning: rename(/var/www/html/master/typo3temp/Cache/Data/cache_classes/52d9026814521.temp,/var/www/html/master/typo3temp/Cache/Data/cache_classes/typo3_cms_extbase_property_typeconverter_fileconverter): No such file or directory in ..../typo3/sysext/core/Classes/Cache/Backend/SimpleFileBackend.php on line 244

(the affected class looks rather random, but it is always the same line 244)

You can continue at this point to work in BE, but
if you clear the configuration cache again and
quickly click on a page in the tree, the complete BE fails.

The warning above is displayed again and additionally this is displayed:

PHP Warning: Class 'TYPO3\CMS\Core\Log\Loggerphp' not found in ..../typo3/sysext/core/Classes/Core/ClassAliasMap.php line 270
or
PHP Warning: Class 'TYPO3\CMS\Core\Resource\ResourceInterfacer\AbstractController' not found in ..../typo3/sysext/core/Classes/Core/ClassAliasMap.php line 270

One has to clear typo3temp manually in order to get the BE back to work.
I've no clue what's going on here, looks like some timing issue and/or race condition.

Note: I've activated this setting in the installer in order to really see all (otherwise silent) warnings:
['SYS']['exceptionalErrors'] => '28674'


Related issues

Related to TYPO3 Core - Bug #55029: Class Loader fails if entry in class cache is discarded Closed 2014-01-15
Related to TYPO3 Core - Bug #54768: t3lib_pageSelect* compatibility classes not loaded in backend Closed 2014-01-06
Related to TYPO3 Core - Bug #54906: Fatal error: Interface 'Psr\Log\LoggerInterface' not found Closed 2014-03-12 2014-03-12
Related to TYPO3 Core - Bug #55294: Under heavy load, two request can simultaneously write to same cache file - should use locking Closed 2014-01-24
Related to TYPO3 Core - Bug #57008: New Installation: Could not acquire lock for ClassLoader Closed 2014-03-17
Related to TYPO3 Core - Feature #47712: Refactor Locking Closed 2013-02-08
Related to TYPO3 Core - Bug #67366: PHP Errors after clearing cache in BE New 2015-06-09

Associated revisions

Revision 76284d26 (diff)
Added by Alexander Opitz over 5 years ago

[BUGFIX] Implement locking in ClassLoader

After cache clearing we can run in the situation that 2 processes will
rebuild the ClassLoader cache which will lead to a non useable cache,
which produces fatals. As the data is generated more than once the load
of the server increases per request while ClassLoader cache is build.

The implemented Locking will stop this issue. Every process waits till
the first is ready and then looks if data was generated and stops re-
generating the cache.

Resolves: #55099
Releases: 6.2
Change-Id: I109821b9c37ec99c5ec5dbc5bcef6223d1d0d153
Reviewed-on: https://review.typo3.org/28156
Reviewed-by: Markus Klein
Tested-by: Markus Klein
Reviewed-by: Thomas Maroschik
Tested-by: Thomas Maroschik
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring

Revision 2268f64c (diff)
Added by Alexander Opitz over 5 years ago

[BUGFIX] Implement locking in ClassLoader

After cache clearing we can run in the situation that 2 processes will
rebuild the ClassLoader cache which will lead to a non useable cache,
which produces fatals. As the data is generated more than once the load
of the server increases per request while ClassLoader cache is build.

The implemented Locking will stop this issue. Every process waits till
the first is ready and then looks if data was generated and stops re-
generating the cache.

To-Do: Make it work also for first time installation when there is
no typo3temp/ directory yet.

Resolves: #55099
Releases: 6.2
Change-Id: I9c1916b5b5860e86fe19a1fc292d8ab5a196d960
Reviewed-on: https://review.typo3.org/28480
Reviewed-by: Ernesto Baschny
Tested-by: Ernesto Baschny

History

#1 Updated by Helmut Hummel almost 6 years ago

Markus Klein wrote:

Steps to reproduce
  1. rm -rf typo3temp/*
  2. Open BE, Page module
  3. Click on some random page in the tree
  4. Clear the configuration cache via toolbar icon
  5. Click on some page again in the tree

An extdirect exception popups at the bottom of the BE
[...]
(the affected class looks rather random, but it is always the same line 244)

I cannot reproduce this on my system, but saw these warnings on a customer system lately.
While this is very likely a race condition in the file backend, I'm still asking myself how this happens and if the temp file is missing during that operation or if some directory is not present.

#2 Updated by Helmut Hummel almost 6 years ago

Markus Klein wrote:

You can continue at this point to work in BE, but
if you clear the configuration cache again and
quickly click on a page in the tree, the complete BE fails.

If the classes cache is inconsistent, everything breaks currently.
See #55029

Needs to be fixed!

#3 Updated by Markus Klein almost 6 years ago

Thanks for your response Helmut.

Without knowing the code right now, do the cache backends use any locking at all?

#4 Updated by Oliver Hader almost 6 years ago

Important one... just ran into this issue with extensions using type hints in backend hooks pointing e.g. to t3lib_TCEmain and that class alias not being available...

#5 Updated by Franz Holzinger almost 6 years ago

I randomly get some error and warning messages if I want to use the EM.

PHP Warning:  rename(/mypath/typo3temp/Cache/Data/cache_classes/530ce35ad4603.temp,/mypath/typo3temp/Cache/Data/cache_classes/typo3_cms_core_compatibility_loadedextensionsarray) [<a href='function.rename'>function.rename</a>]: No such file or directory in /mypath/typo3/sysext/core/Classes/Cache/Backend/SimpleFileBackend.php on line 244
PHP Warning:  rename(/mypath/typo3temp/Cache/Data/cache_classes/530ce35b64123.temp,/mypath/typo3temp/Cache/Data/cache_classes/clearcachemenu) [<a href='function.rename'>function.rename</a>]: No such file or directory in /mypath/typo3/sysext/core/Classes/Cache/Backend/SimpleFileBackend.php on line 244
PHP Warning:  rename(/mypath/typo3temp/Cache/Data/cache_classes/530ce35b68f43.temp,/mypath/typo3temp/Cache/Data/cache_classes/typo3_cms_backend_toolbar_livesearchtoolbaritem) [<a href='function.rename'>function.rename</a>]: No such file or directory in /mypath/typo3/sysext/core/Classes/Cache/Backend/SimpleFileBackend.php on line 244
PHP Fatal error:  Class 'TYPO3\CMS\Backend\Sprite\AbstractSpriteHandler' not found in /mypath/typo3/sysext/backend/Classes/Sprite/SimpleSpriteHandler.php on line 40
PHP Fatal error:  Class 'TYPO3\CMS\Core\Resource\Driver\AbstractDriver' not found in /mypath/typo3/sysext/core/Classes/Resource/Driver/AbstractHierarchicalFilesystemDriver.php on line 35
PHP Fatal error: Class 'TYPO3\CMS\Core\Resource\ResourceStorage' not found in /mypath/typo3temp/Cache/Code/cache_core/ext_localconf_ff0939e805d9053eba290499baf8d6edbd4fb258.php on line 38

#6 Updated by Markus Klein almost 6 years ago

Please see the blueprint for solving this: http://wiki.typo3.org/Blueprints/LockingForCaches

#7 Updated by Gerrit Code Review over 5 years ago

  • Status changed from Accepted to Under Review

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

#8 Updated by Thomas Maroschik over 5 years ago

I have written a bash script to provoke the error

#!/bin/bash

i="0" 
url="http://introductionpackage.dev.dfau/index.php?id=51" 

while true
do
        rm -R typo3temp/Cache
        i=$[$i+1]
        curl -s -o - $url | grep -o "Fatal error:.*</i>" && echo "Request $i failed" &
        i=$[$i+1]
        curl -s -o - $url | grep -o "Fatal error:.*</i>" && echo "Request $i failed" &
        wait
done
wait

Please replace the url variable with one that matches your site. Run this script from the site root. It tests frontend requests but the issue is present there too.

#9 Updated by Alexander Opitz over 5 years ago

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

#10 Updated by Ernesto Baschny over 5 years ago

  • Status changed from Resolved to On Hold

This was reverted for 6.2 beta7: https://review.typo3.org/#/c/28426/

Will be re-added afterwards again.

#11 Updated by Gerrit Code Review over 5 years ago

  • Status changed from On Hold 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/28480

#12 Updated by Alexander Opitz over 5 years ago

  • Status changed from Under Review to Resolved

#13 Updated by Benni Mack about 1 year ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF