-
Notifications
You must be signed in to change notification settings - Fork 11.8k
Description
Laravel Version
12.47.0
PHP Version
8.4.16
Database Driver & Version
No response
Description
As one of the projects I am working on has grown, we are seeing increasingly frequent random cached view errors during HTTP tests when running the test suite in parallel (ParaTest v7.16.1, PHPUnit 12.5.4, 4 processes).
Example error:
Illuminate\\Contracts\\Filesystem\\FileNotFoundException(code: 0): File does not exist at path /Volumes/Code/project/storage/framework/views/6814e7936e2e72aeafad6e54f9d8a79f.blade.php. at /Volumes/Code/project/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:58)
[stacktrace]
#0 /Volumes/Code/project/vendor/laravel/framework/src/Illuminate/View/Compilers/BladeCompiler.php(188): Illuminate\\Filesystem\\Filesystem->get('/Volumes/Code/f...')
#1 /Volumes/Code/project/vendor/laravel/framework/src/Illuminate/View/Engines/CompilerEngine.php(86): Illuminate\\View\\Compilers\\BladeCompiler->compile('/Volumes/Code/f...')
#2 /Volumes/Code/project/vendor/livewire/livewire/src/Mechanisms/ExtendBlade/ExtendedCompilerEngine.php(10): Illuminate\\View\\Engines\\CompilerEngine->get('/Volumes/Code/f...', Array)
#3 /Volumes/Code/project/vendor/laravel/framework/src/Illuminate/View/View.php(208): Livewire\\Mechanisms\\ExtendBlade\\ExtendedCompilerEngine->get
This appears to be a timing / race condition related to cached Blade views when running tests in parallel.
I have searched for similar issues in the Laravel repository but could not find any, which leaves me with three possible explanations:
- We have some unusual code that triggers this behavior.
- The issue only occurs under very specific circumstances.
- Others are experiencing similar problems, but they haven’t reported them because they are difficult to reproduce.
I did find a related discussion on Laracasts that describes a similar symptom and proposes a workaround by using separate view storage paths per process: https://laracasts.com/discuss/channels/testing/laravel-parallel-testing-with-separate-storage-for-views-per-process
This workaround resolves the issue for me, but it feels like a fragile solution that could break with future Laravel upgrades. Ideally, this would be handled more robustly at the framework level. I have tried to solve it more cleanly using Laravel’s parallel testing hooks in the boot() method of the AppServiceProvider, but those hooks appear to run too late in the lifecycle to influence the BladeCompiler.
Steps To Reproduce
I have not been able to reliably reproduce the issue in isolation. It occurs intermittently when running a larger test suite in parallel. The issue is not limited to my local environment and also occurs on GitHub Actions runners.