neos-development-collection icon indicating copy to clipboard operation
neos-development-collection copied to clipboard

BUG: `Neos_Fusion_ParsePartials` cache not flushed for moved files because `realpath` fails

Open mhsdesign opened this issue 2 years ago • 0 comments

From Neos 8.3.0 .. 8.3.9 we didnt handle this case by just throwing an error.

Exception in line 53 of /Users/marchenryschultz/Code/core/Neos.NeosIo/Packages/Application/Neos.Fusion/Classes/Core/Cache/ParserCacheFlusher.php: Couldn't resolve realpath for: '/Users/marchenryschultz/Code/core/Neos.NeosIo/Packages/Sites/Neos.NeosIo/Resources/Private/Fusion/Content/BrandLogo/BrandLogo.fusion'

21 Neos\Fusion\Core\Cache\ParserCacheFlusher::getCacheIdentifierForFile("/Users/marchenryschultz/Code/core/Neos.NeosIo/Pack…/Private/Fusion/Content/BrandLogo/BrandLogo.fusion")
20 Neos\Fusion\Core\Cache\ParserCacheFlusher::flushPartialCacheOnFileChanges("Fusion_Files", array|107|, "Neos\Flow\Monitor\FileMonitor::filesHaveChanged")
19 call_user_func_array(array|2|, array|3|)
18 Neos\Flow\SignalSlot\Dispatcher::dispatch("Neos\Flow\Monitor\FileMonitor", "filesHaveChanged", array|2|)
17 Neos\Flow\Monitor\FileMonitor_Original::emitFilesHaveChanged("Fusion_Files", array|107|)
16 Neos\Flow\Monitor\FileMonitor_Original::detectChanges()
15 Neos\Fusion\Package::Neos\Fusion\{closure}(Neos\Flow\Core\Booting\Step, "runtime", "Neos\Flow\Core\Booting\Sequence::afterInvokeStep")
14 Closure::__invoke(Neos\Flow\Core\Booting\Step, "runtime", "Neos\Flow\Core\Booting\Sequence::afterInvokeStep")
13 call_user_func_array(array|2|, array|3|)
12 Neos\Flow\SignalSlot\Dispatcher::dispatch("Neos\Flow\Core\Booting\Sequence", "afterInvokeStep", array|2|)
11 Neos\Flow\Core\Booting\Sequence::invokeStep(Neos\Flow\Core\Booting\Step, Neos\Flow\Core\Bootstrap)
10 Neos\Flow\Core\Booting\Sequence::invokeStep(Neos\Flow\Core\Booting\Step, Neos\Flow\Core\Bootstrap)
9 Neos\Flow\Core\Booting\Sequence::invokeStep(Neos\Flow\Core\Booting\Step, Neos\Flow\Core\Bootstrap)
8 Neos\Flow\Core\Booting\Sequence::invokeStep(Neos\Flow\Core\Booting\Step, Neos\Flow\Core\Bootstrap)
7 Neos\Flow\Core\Booting\Sequence::invokeStep(Neos\Flow\Core\Booting\Step, Neos\Flow\Core\Bootstrap)
6 Neos\Flow\Core\Booting\Sequence::invokeStep(Neos\Flow\Core\Booting\Step, Neos\Flow\Core\Bootstrap)
5 Neos\Flow\Core\Booting\Sequence::invokeStep(Neos\Flow\Core\Booting\Step, Neos\Flow\Core\Bootstrap)
4 Neos\Flow\Core\Booting\Sequence::invoke(Neos\Flow\Core\Bootstrap)
3 Neos\Flow\Http\RequestHandler::boot()
2 Neos\Flow\Http\RequestHandler::handleRequest()
1 Neos\Flow\Core\Bootstrap::run()

With Neos 8.3.10 https://github.com/neos/neos-development-collection/pull/4838 tried to fix this, but accidentally completely broke caching.

Instead the current hotfix is to silently ignore removed fusion files and not trigger cache invalidator for them. That would lead to a growing cache and maybe odd behaviour in some cases, but that seems a better compromise. Related issue of flows php caching not being flushed for delted classes: https://github.com/neos/flow-development-collection/issues/3303

for some reason it also happened for js files???

yes because we listen to everything: https://github.com/neos/neos-development-collection/issues/4606#issuecomment-1896187044

Exception in line 53 of /Users/marchenryschultz/Code/core/Neos.NeosIo/Packages/Application/Neos.Fusion/Classes/Core/Cache/ParserCacheFlusher.php: Couldn't resolve realpath for: '/Users/marchenryschultz/Code/core/Neos.NeosIo/Packages/Sites/Neos.NeosIo/Resources/Private/Fusion/Content/Tabs/Tabs.js'

21 Neos\Fusion\Core\Cache\ParserCacheFlusher::getCacheIdentifierForFile("/Users/marchenryschultz/Code/core/Neos.NeosIo/Pack…osIo/Resources/Private/Fusion/Content/Tabs/Tabs.js")
20 Neos\Fusion\Core\Cache\ParserCacheFlusher::flushPartialCacheOnFileChanges("Fusion_Files", array|2|, "Neos\Flow\Monitor\FileMonitor::filesHaveChanged")
19 call_user_func_array(array|2|, array|3|)
18 Neos\Flow\SignalSlot\Dispatcher::dispatch("Neos\Flow\Monitor\FileMonitor", "filesHaveChanged", array|2|)
17 Neos\Flow\Monitor\FileMonitor_Original::emitFilesHaveChanged("Fusion_Files", array|2|)
16 Neos\Flow\Monitor\FileMonitor_Original::detectChanges()
15 Neos\Fusion\Package::Neos\Fusion\{closure}(Neos\Flow\Core\Booting\Step, "runtime", "Neos\Flow\Core\Booting\Sequence::afterInvokeStep")
14 Closure::__invoke(Neos\Flow\Core\Booting\Step, "runtime", "Neos\Flow\Core\Booting\Sequence::afterInvokeStep")
13 call_user_func_array(array|2|, array|3|)
12 Neos\Flow\SignalSlot\Dispatcher::dispatch("Neos\Flow\Core\Booting\Sequence", "afterInvokeStep", array|2|)
11 Neos\Flow\Core\Booting\Sequence::invokeStep(Neos\Flow\Core\Booting\Step, Neos\Flow\Core\Bootstrap)
10 Neos\Flow\Core\Booting\Sequence::invokeStep(Neos\Flow\Core\Booting\Step, Neos\Flow\Core\Bootstrap)
9 Neos\Flow\Core\Booting\Sequence::invokeStep(Neos\Flow\Core\Booting\Step, Neos\Flow\Core\Bootstrap)
8 Neos\Flow\Core\Booting\Sequence::invokeStep(Neos\Flow\Core\Booting\Step, Neos\Flow\Core\Bootstrap)
7 Neos\Flow\Core\Booting\Sequence::invokeStep(Neos\Flow\Core\Booting\Step, Neos\Flow\Core\Bootstrap)
6 Neos\Flow\Core\Booting\Sequence::invokeStep(Neos\Flow\Core\Booting\Step, Neos\Flow\Core\Bootstrap)
5 Neos\Flow\Core\Booting\Sequence::invokeStep(Neos\Flow\Core\Booting\Step, Neos\Flow\Core\Bootstrap)
4 Neos\Flow\Core\Booting\Sequence::invoke(Neos\Flow\Core\Bootstrap)
3 Neos\Flow\Http\RequestHandler::boot()
2 Neos\Flow\Http\RequestHandler::handleRequest()
1 Neos\Flow\Core\Bootstrap::run()

It seems that when deleting files we dont correctly handle them.

option A: flush all if it couldn't resolve? option B: assume its already a full path and still calculate the cache identifier.

mhsdesign avatar Jul 26 '23 14:07 mhsdesign