Bug #84654
closedIf problem with creation of logger, an Exception is thrown: A cache with identifier "assets" does not exist
100%
Description
Reproduced with current master (9.2-dev).
Reproduce¶
- Create logging configuration that uses typo3temp/logs for Logger
- Remove write access for typo3temp/logs for Webserver `chmod 440 typo3temp/logs`
- Reload backend, click "Log module"
(same scenario as in issue #84646)
Exception¶
Configuration in AdditionalConfiguration.php¶
$GLOBALS['TYPO3_CONF_VARS']['LOG']['writerConfiguration'] = [
\TYPO3\CMS\Core\Log\LogLevel::ERROR => [
'TYPO3\\CMS\\Core\\Log\\Writer\\FileWriter' => [
'logFile' => 'typo3temp/logs/typo3-error.log'
]
],
\TYPO3\CMS\Core\Log\LogLevel::DEBUG => [
'TYPO3\\CMS\\Core\\Log\\Writer\\FileWriter' => [
'logFile' => 'typo3temp/logs/typo3-debug.log'
]
]
];
Files
Updated by Sybille Peters over 6 years ago
- Related to Bug #84646: Exception in ErrorHandler if problem instantiating logger (Reboustness) added
Updated by Jonas Eberle about 5 years ago
I second that. We should try to find out if e.g. write permissions are causing the problem and show a more helping text in that case.
Updated by Henri Nathanson about 5 years ago
Perhaps one should not delete the files in /var/log/.. manually. Truncation of cf_ - tables fixed this.
Updated by Bastian Stargazer over 4 years ago
The same error is thrown if I try to use the TYPO3 console:
.../my-t3project$ php typo3/sysext/core/bin/typo3 list PHP Fatal error: Uncaught TYPO3\CMS\Core\Cache\Exception\NoSuchCacheException: A cache with identifier "assets" does not exist. in /webserver/libraries/typo3_src-9.5.11/typo3/sysext/core/Classes/Cache/CacheManager.php:137 Stack trace: #0 /webserver/libraries/typo3_src-9.5.11/typo3/sysext/core/Classes/Imaging/IconRegistry.php(540): TYPO3\CMS\Core\Cache\CacheManager->getCache() #1 /webserver/libraries/typo3_src-9.5.11/typo3/sysext/core/Classes/Imaging/IconRegistry.php(514): TYPO3\CMS\Core\Imaging\IconRegistry->getCachedBackendIcons() #2 /webserver/libraries/typo3_src-9.5.11/typo3/sysext/core/Classes/Imaging/IconRegistry.php(494): TYPO3\CMS\Core\Imaging\IconRegistry->initialize() #3 /webserver/libraries/typo3_src-9.5.11/typo3/sysext/core/Classes/Utility/GeneralUtility.php(3675): TYPO3\CMS\Core\Imaging\IconRegistry->__construct() #4 /webserver/libraries/typo3_src-9.5.11/typo3/sysext/core/Classes/Imaging/IconFactory.php(65): TYPO3\CMS\Core\Utility\GeneralUtility::ma in /webserver/libraries/typo3_src-9.5.11/typo3/sysext/core/Classes/Cache/CacheManager.php on line 137
System:
- Ubuntu 18.04
- PHP 7.2
- TYPO3 v9.5.11 (manual install from ZIP)
Updated by Georg Ringer over 4 years ago
@Bastian: Never had this problem, can you disable all extensions and retry?
Updated by Sybille Peters over 4 years ago
My originally reported problem is pretty exotic. It should not really happen if everything was correctly setup. A more helpful error message (as Jonas suggested) would take care of the problem.
I don't know if the problem from Bastian is the same problem.
From my end, I would be ok with closing.
Updated by Tymoteusz Motylewski over 4 years ago
I stumbled upon similar issue in 9.5 when during deployment var/log folder was created using wrong user which resulted in TYPO3 not being able to write in it (typo3 console cache:flush run with wrong user).
Definitely the error should be different and ideally something less severe than fatal error.
The problem is that FileWriter::createLogFile just checks for file existance and not whether file is writeable.
Then another issue is in the ErrorHandler, which instead of handling gracefuly the reall error which is
Core: Error handler (FE): PHP Warning: fopen(/var/www/html/project/var/log/typo3_000000.log): failed to open stream: Permission denied in /var/www/html/project/web/typo3/sysext/core/Classes/Log/Writer/FileWriter.php line 194
And this is because ErrorHandler calls setTSlogMessage which has dependency on the IconFactory which depends on IconRegistry which depends on assets cache being configured.
And as cache is not configured yet, the CacheManager throws exception
public function getCache($identifier) { if ($this->hasCache($identifier) === false) { throw new NoSuchCacheException('A cache with identifier "' . $identifier . '" does not exist.', 1203699034); } }
Which is not caught, and results in fatal error.
I think the most severe issue is that ErrorHandler is not bullet proof because it has too many hidden dependencies.
The TimeTracker should not generate images and markup when calling setTSlogMessage, but only when necessary (when messages are being displayed in the admin panel or somewhere else).
Updated by Gerrit Code Review over 4 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/c/Packages/TYPO3.CMS/+/65069
Updated by Gerrit Code Review over 4 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/65069
Updated by Gerrit Code Review over 4 years ago
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/65069
Updated by Gerrit Code Review over 4 years ago
Patch set 1 for branch 10.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/65097
Updated by Benni Mack over 4 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 55d9da5651d35cfe81a63acabab003866a6819b8.