FluidTYPO3 / vhs

TYPO3 extension VHS: Fluid ViewHelpers
https://fluidtypo3.org
Other
190 stars 229 forks source link

v:render.uncache writes absolute path of template in cache - which throws an error if two servers are used #1830

Closed EvelynProjects closed 11 months ago

EvelynProjects commented 1 year ago

Hi,

we had following issue at a deployement with the Render/UncacheViewHelper on our live system:

Core: Exception handler (WEB): Uncaught TYPO3 Exception: #1225709595: The Fluid template files "/var/www/html/releases/398/public/typo3conf/ext/xx.html", "/var/www/html/releases/398/public/typo3conf/ext/xx" could not be loaded. | TYPO3Fluid\Fluid\View\Exception\InvalidTemplateResourceException thrown in file /var/www/html/releases/397/vendor/typo3fluid/fluid/src/View/TemplatePaths.php in line 727.

Info: we have a cluster with two typo3 webservers + one redis server for both webservers But the issue can also occure at a deployement on a "one server infrastructure" when the cache would not be cleared.

Reason for error: The paths of the servers are not identical. e.g. Server 1: /var/www/html/releases/398 e.g. Server 2: /var/www/html/releases/397 With „Render/UncacheViewHelper“ the absolute path of the template file will be written to the cache (e.g. redis). So when the path of server 1 is written to the cache and a request from server 2 is sent to redis, then the path of server 1 will be returned and this error will occur.

Best regards

NamelessCoder commented 11 months ago

The next release of VHS will include a toggle to work with this particular use case. It's not without drawbacks though - see the ViewHelper argument description on https://github.com/FluidTYPO3/vhs/commit/258949ea26e6c2881c6dca0e12bba9c7c37634ad. But it should mean that this shared-cache-with-instances-in-different-paths use case will work, if you stay away from combining it with the custom-partial-paths-set-by-controller use case.