Bug #84654

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

Added by Sybille Peters over 2 years ago. Updated 22 days ago.

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

100%

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

Associated revisions

Revision 55d9da56 (diff)
Added by Benni Mack 3 months ago

[BUGFIX] Skip TimeTracker errors in ErrorHandler

If adding a message to the TimeTracker (for admin panel) in the
ErrorHandler fails, that error fails silently now.

This can happen when e.g. instanstiating logging fails due to file
permission errors.

Resolves: #84654
Releases: master, 10.4
Change-Id: Iba0949539d3b8c315f9d16335e62da59be0adc11
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/65069
Tested-by: TYPO3com <>
Tested-by: Anja Leichsenring <>
Tested-by: Benni Mack <>
Reviewed-by: Anja Leichsenring <>
Reviewed-by: Benni Mack <>

Revision 801f2c35 (diff)
Added by Benni Mack 3 months ago

[BUGFIX] Skip TimeTracker errors in ErrorHandler

If adding a message to the TimeTracker (for admin panel) in the
ErrorHandler fails, that error fails silently now.

This can happen when e.g. instanstiating logging fails due to file
permission errors.

Resolves: #84654
Releases: master, 10.4
Change-Id: Iba0949539d3b8c315f9d16335e62da59be0adc11
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/65097
Tested-by: TYPO3com <>
Tested-by: Benni Mack <>
Reviewed-by: Benni Mack <>

History

#1 Updated by Sybille Peters over 2 years ago

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

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

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

#4 Updated by Bastian Stargazer 8 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 8 months ago

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

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

#8 Updated by Gerrit Code Review 3 months 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

#9 Updated by Gerrit Code Review 3 months 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

#10 Updated by Gerrit Code Review 3 months 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

#11 Updated by Gerrit Code Review 3 months 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

#12 Updated by Benni Mack 3 months ago

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

#13 Updated by Benni Mack 22 days ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF