Cakephp 3.10 - SplFileInfo::openFile dies while /tmp/cache/routes updates. File created with extreme protections

Once this error appears, NO page will load. This error is all we get until I turn off Windows 7 file protections using the registry. Delete the file E:\someapp\tmp\cache\routes/\myapp_cake_routes_route_collection and then turn on Windows 7 file protections again!

ERROR log follows:

2021-07-08 23:11:37 Warning: Warning (512): SplFileInfo::openFile(E:\someapp\tmp\cache\routes/\myapp_cake_routes_route_collection): failed to open stream: Permission denied in [E:\someapp\vendor\cakephp\cakephp\src\Cache\Engine\FileEngine.php, line 421]
Trace:
Cake\Error\BaseErrorHandler::handleError() - CORE\src\Error\BaseErrorHandler.php, line 168
Cake\Core\BasePlugin::{closure}() - ROOT\vendor\cakephp\debug_kit\config\bootstrap.php, line 43
Cake\Cache\Engine\FileEngine::_setKey() - CORE\src\Cache\Engine\FileEngine.php, line 421
Cake\Cache\Engine\FileEngine::write() - CORE\src\Cache\Engine\FileEngine.php, line 134
DebugKit\Cache\Engine\DebugEngine::write() - ROOT\vendor\cakephp\debug_kit\src\Cache\Engine\DebugEngine.php, line 123
Cake\Cache\SimpleCacheEngine::set() - CORE\src\Cache\SimpleCacheEngine.php, line 118
Cake\Cache\Cache::write() - CORE\src\Cache\Cache.php, line 297
Cake\Cache\Cache::remember() - CORE\src\Cache\Cache.php, line 659
Cake\Routing\Middleware\RoutingMiddleware::buildRouteCollection() - CORE\src\Routing\Middleware\RoutingMiddleware.php, line 103
Cake\Routing\Middleware\RoutingMiddleware::loadRoutes() - CORE\src\Routing\Middleware\RoutingMiddleware.php, line 89
Cake\Routing\Middleware\RoutingMiddleware::__invoke() - CORE\src\Routing\Middleware\RoutingMiddleware.php, line 138
Cake\Http\Runner::__invoke() - CORE\src\Http\Runner.php, line 65
Cake\Routing\Middleware\AssetMiddleware::__invoke() - CORE\src\Routing\Middleware\AssetMiddleware.php, line 88
Cake\Http\Runner::__invoke() - CORE\src\Http\Runner.php, line 65
Cake\Error\Middleware\ErrorHandlerMiddleware::__invoke() - CORE\src\Error\Middleware\ErrorHandlerMiddleware.php, line 100
Cake\Http\Runner::__invoke() - CORE\src\Http\Runner.php, line 65
DebugKit\Middleware\DebugKitMiddleware::__invoke() - ROOT\vendor\cakephp\debug_kit\src\Middleware\DebugKitMiddleware.php, line 53
Cake\Http\Runner::__invoke() - CORE\src\Http\Runner.php, line 65
Cake\Http\Runner::run() - CORE\src\Http\Runner.php, line 51
Cake\Http\Server::run() - CORE\src\Http\Server.php, line 97
[main] - ROOT\webroot\index.php, line 40



2021-07-08 23:11:37 Warning: Warning (512): _cake_routes_ cache was unable to write 'routeCollection' to Cake\Cache\SimpleCacheEngine cache in [E:\someapp\vendor\cakephp\cakephp\src\Cache\Cache.php, line 306]
Trace:
Cake\Error\BaseErrorHandler::handleError() - CORE\src\Error\BaseErrorHandler.php, line 168
Cake\Core\BasePlugin::{closure}() - ROOT\vendor\cakephp\debug_kit\config\bootstrap.php, line 43
Cake\Cache\Cache::write() - CORE\src\Cache\Cache.php, line 306
Cake\Cache\Cache::remember() - CORE\src\Cache\Cache.php, line 659
Cake\Routing\Middleware\RoutingMiddleware::buildRouteCollection() - CORE\src\Routing\Middleware\RoutingMiddleware.php, line 103
Cake\Routing\Middleware\RoutingMiddleware::loadRoutes() - CORE\src\Routing\Middleware\RoutingMiddleware.php, line 89
Cake\Routing\Middleware\RoutingMiddleware::__invoke() - CORE\src\Routing\Middleware\RoutingMiddleware.php, line 138
Cake\Http\Runner::__invoke() - CORE\src\Http\Runner.php, line 65
Cake\Routing\Middleware\AssetMiddleware::__invoke() - CORE\src\Routing\Middleware\AssetMiddleware.php, line 88
Cake\Http\Runner::__invoke() - CORE\src\Http\Runner.php, line 65
Cake\Error\Middleware\ErrorHandlerMiddleware::__invoke() - CORE\src\Error\Middleware\ErrorHandlerMiddleware.php, line 100
Cake\Http\Runner::__invoke() - CORE\src\Http\Runner.php, line 65
DebugKit\Middleware\DebugKitMiddleware::__invoke() - ROOT\vendor\cakephp\debug_kit\src\Middleware\DebugKitMiddleware.php, line 53
Cake\Http\Runner::__invoke() - CORE\src\Http\Runner.php, line 65
Cake\Http\Runner::run() - CORE\src\Http\Runner.php, line 51
Cake\Http\Server::run() - CORE\src\Http\Server.php, line 97
[main] - ROOT\webroot\index.php, line 40



2021-07-08 23:11:37 Warning: Warning (512): Unable to emit headers. Headers sent in file=E:\someapp\vendor\cakephp\cakephp\src\Error\Debugger.php line=855 in [E:\someapp\vendor\cakephp\cakephp\src\Http\ResponseEmitter.php, line 53]
Request URL: /
Client IP: 127.0.0.1
Trace:
Cake\Error\BaseErrorHandler::handleError() - CORE\src\Error\BaseErrorHandler.php, line 168
Cake\Core\BasePlugin::{closure}() - ROOT\vendor\cakephp\debug_kit\config\bootstrap.php, line 43
Cake\Http\ResponseEmitter::emit() - CORE\src\Http\ResponseEmitter.php, line 53
Cake\Http\Server::emit() - CORE\src\Http\Server.php, line 140
[main] - ROOT\webroot\index.php, line 40



2021-07-08 23:11:37 Warning: Warning (2): Cannot modify header information - headers already sent by (output started at E:\someapp\vendor\cakephp\cakephp\src\Error\Debugger.php:855) in [E:\someapp\vendor\cakephp\cakephp\src\Http\ResponseEmitter.php, line 154]
Request URL: /
Client IP: 127.0.0.1
Trace:
Cake\Error\BaseErrorHandler::handleError() - CORE\src\Error\BaseErrorHandler.php, line 168
Cake\Core\BasePlugin::{closure}() - ROOT\vendor\cakephp\debug_kit\config\bootstrap.php, line 43
header - [internal], line ??
Cake\Http\ResponseEmitter::emitStatusLine() - CORE\src\Http\ResponseEmitter.php, line 154
Cake\Http\ResponseEmitter::emit() - CORE\src\Http\ResponseEmitter.php, line 59
Cake\Http\Server::emit() - CORE\src\Http\Server.php, line 140
[main] - ROOT\webroot\index.php, line 40

<snip>

Seems weird that it’s got “/” in the path. Dunno if that’s part of the problem, but indicative of something not quite configured right?

Check permissions / ownership of the file when it’s running okay, and when it starts to fail. Maybe somebody is running a command-line task under a different user, which is giving the file permissions that the web server user can’t access?