Project

General

Profile

Actions

Bug #100123

open

Regular exceptions due to dependency injection (di) cache

Added by Sybille Peters over 1 year ago. Updated 7 months ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Caching
Target version:
-
Start date:
2023-03-09
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
11
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

I have regular error messages in the logs due to Dependency Injection cache /var/cache/code/di. This improved considerably, after switching from shared (NFS) to the VM storage, but has not disappeared.

This also results in error message when loading a page in frontend. When page is loaded again, it is ok. Since (page) cache is warmed up at night and after deployment, these errors are usually not noticed, but it does happen.

Switching to non-NFS:

- entire var/cache/code switched to local storage
- when deploying, system cache on all machines must be flushed (and opcache also, of course)
- cache is warmed up during deployment ("@php vendor/bin/typo3 cache:warmup")

The number of log messages with these errors are reduced. Last time I checked, I had roughly 60, all with nearly same timestamp (within 20 seconds).

setup

  • TYPO3 11.5.24
  • dual machines behind load-balancer, however currently only one at a time utilized, other is fallback
  • uses the defaults for caching, except what is usually in the DB is in Redis and b13/distributed-locking is used for shared locking. var/cache/di is switched to local storage

Logs

ssl_access.log
1)
"Call to a member function resolvePackagePath"

Thu Mar 02 05:26:22 2023] [error] [pid 18699] mod_proxy_fcgi.c(851): [client 54.36.148.228:29271] AH01071: Got error 'PHP message:
PHP Fatal error:  Uncaught Error: Call to a member function resolvePackagePath()
on null in
/var/www/mysite/releases/1/public/typo3/sysext/core/Classes/Utility/ExtensionManagementUtility.php:135

TYPO3 log (logfile if default LogWriter is used, usually in var/log or typo3temp/var/log)

2)

"The temporary cache file .*cache/code/di/.*could not be written"

Thu, 02 Mar 2023 23:36:22 +0100 [CRITICAL] request="825e1a685dff9" component="TYPO3.CMS.Core.Error.ProductionExceptionHandler":
Core: Exception handler (WEB: BE): TYPO3\CMS\Core\Cache\Exception, code #1334756737,
file /var/www/www.uni-oldenburg.de/releases/115/htdocs/typo3/sysext/core/Classes/Cache/Backend/SimpleFileBackend.php, line 232:
The temporary cache file "/var/www/www.uni-oldenburg.de/releases/115/var/cache/code/di/640124e6f2270786869194.temp" could not be written. - {"mode":"WEB","application_mode":"BE","exception_class":"TYPO3\\CMS\\Core\\Cache\\Exception","exception_code":1334756737,"file":"/var/www/www.uni-oldenburg.de/releases/115/htdocs/typo3/sysext/core/Classes/Cache/Backend/SimpleFileBackend.php","line":232,"message":"The temporary cache file \"/var/www/www.uni-oldenburg.de/releases/115/var/cache/code/di/640124e6f2270786869194.temp\" could not be written.","request_url":"https://mysite/","exception":null}

3)
"Class 'DependencyInjectionContainer_[0-9a-f]*' not found"

Fri, 03 Mar 2023 00:11:29 +0100 [CRITICAL] request="91d0aa2d1ff6e" component="TYPO3.CMS.Core.Error.ProductionExceptionHandler": Core: Exception handler (WEB: BE): Error, code #0, file /var/www/www.uni-oldenburg.de/releases/115/htdocs/typo3/sysext/core/Classes/DependencyInjection/ContainerBuilder.php, line 98: Class 'DependencyInjectionContainer_dfe57bd75f64f6fcd823c25279efdcb969473f70' not found - {"mode":"WEB","application_mode":"BE","exception_class":"Error","exception_code":0,"file":"/var/www/www.uni-oldenburg.de/releases/115/htdocs/typo3/sysext/core/Classes/DependencyInjection/ContainerBuilder.php","line":98,"message":"Class 'DependencyInjectionContainer_dfe57bd75f64f6fcd823c25279efdcb969473f70' not found","request_url":"https://mysite/","exception":null}


Related issues 2 (1 open1 closed)

Related to TYPO3 Core - Bug #97731: DependencyInjectionContainer issues with shared storage on High Available setupClosed2022-06-03

Actions
Related to TYPO3 Core - Bug #91768: Race condition while caching data using SimpleFileBackendUnder Review2020-07-08

Actions
Actions #1

Updated by Sybille Peters over 1 year ago

  • Related to Bug #97731: DependencyInjectionContainer issues with shared storage on High Available setup added
Actions #2

Updated by Stephan Großberndt 10 months ago · Edited

Same issue here, I also have the issue exactly like you with multiple hosts for high availability, but additionally I also have it on at least one instance without a load balancing setup. TYPO3 11.5.33

Core: Exception handler (WEB): Uncaught TYPO3 Exception: Class 'DependencyInjectionContainer_f256ee52bc9d8ee1296f6d6a4fd948bd1efbc7c3' not found | Error thrown in file /var/www/domain/releases/185/private/typo3/sysext/core/Classes/DependencyInjection/ContainerBuilder.php in line 98. Requested URL: xxx

Core: Exception handler (WEB): Uncaught TYPO3 Exception: #1334756737: The temporary cache file "/var/www/doman/releases/185/var/cache/code/di/65a7681100488496629287.temp" could not be written. | TYPO3\CMS\Core\Cache\Exception thrown in file /var/www/domain/releases/185/private/typo3/sysext/core/Classes/Cache/Backend/SimpleFileBackend.php in line 232. Requested URL: xxx
Actions #3

Updated by Stephan Großberndt 10 months ago

  • Related to Bug #91768: Race condition while caching data using SimpleFileBackend added
Actions #4

Updated by Ulrich Mathes 7 months ago

We have this problem after deployment. file_put_contents only works when the directory is already present and writable.

Maybe the file_put_contents should be hardend with GeneralUtility::mkdir_deep.
On the other Hand, SimpleFileBackend::setCache() handles the creation of the cache directory.

This problem does apply to TYPO3 12 and 13.


In both error logs presented before, we see that these instances also are placed in releases folders. So maybe this is a hint in the right direction.

Our deployment does not copy /var from the current release to the new one as we want a fresh instance. So in deployment this folder might not be present in some point.

A look in our deployment shows the following sequence:
  1. composer install in docker container
  2. rsync
  3. symlink
  4. extension:setup
  5. cachetool:clear:opcache
  6. cache:flush
  7. cache:warmup
In ddev with var/cache deleted before executing each step:
  1. folder not created, no error
  2. does not apply here
  3. sets up the folder, no error
  4. does not apply here
  5. sets up the folder, no error
  6. sets up the folder, no error

I could think of requests started between symlink is switched and extension:setup.
Maybe we should change the order and take care that the folder is present before switching the symlink.

Actions

Also available in: Atom PDF