Project

General

Profile

Actions

Bug #84654

closed

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

Added by Sybille Peters over 6 years ago. Updated about 4 years ago.

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

100%

Estimated time:
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'
    ]
  ]    
];


Files

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

Related issues 1 (0 open1 closed)

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

Actions
Actions #1

Updated by Sybille Peters over 6 years ago

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

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.

Actions #3

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.

Actions #4

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)

Actions #5

Updated by Georg Ringer over 4 years ago

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

Actions #6

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.

Actions #7

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).

Actions #8

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

Actions #9

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

Actions #10

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

Actions #11

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

Actions #12

Updated by Benni Mack over 4 years ago

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

Updated by Benni Mack about 4 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF