Bug #84654

If problem with creation of logger, an Exception is thrown: A cache with identifier "assets" does not exist

Added by Sybille Peters about 2 years ago. Updated 2 months ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Logging
Target version:
-
Start date:
2018-04-07
Due date:
% Done:

0%

TYPO3 Version:
9
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Reproduced with current master (9.2-dev).

Reproduce

  1. Create logging configuration that uses typo3temp/logs for Logger
  2. Remove write access for typo3temp/logs for Webserver `chmod 440 typo3temp/logs`
  3. 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'
    ]
  ]    
];

exception-assets.png View (313 KB) Sybille Peters, 2018-04-07 06:08


Related issues

Related to TYPO3 Core - Bug #84646: Exception in ErrorHandler if problem instantiating logger (Reboustness) Closed 2018-04-06

History

#1 Updated by Sybille Peters about 2 years ago

  • Related to Bug #84646: Exception in ErrorHandler if problem instantiating logger (Reboustness) added

#2 Updated by Jonas Eberle 7 months 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.

#3 Updated by Henri Nathanson 7 months ago

Perhaps one should not delete the files in /var/log/.. manually. Truncation of cf_ - tables fixed this.

#4 Updated by Bastian Stargazer 3 months 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)

#5 Updated by Georg Ringer 3 months ago

@Bastian: Never had this problem, can you disable all extensions and retry?

#6 Updated by Sybille Peters 3 months 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.

#7 Updated by Tymoteusz Motylewski 2 months 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).

Also available in: Atom PDF