Closed
Description
We recently launched a site using Laravel 4 and noticed cache reading related errors in our PHP logs. These seem to happen about 3 times a day so far and we are getting on average about 200 requests per minute. We are using the FileStore driver. Most of the cached content has a TTL of 60 minutes.
Here is a truncated stack trace of one of these events.
[2013-09-11 17:26:57] log.ERROR: exception 'ErrorException' with message 'file_get_contents(/var/www/site/app/storage/cache/12/2f/122f8f5cbff4807f3b06cf5d2256355b): failed to open stream: No such file or directory' in /var/www/site/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:29
Stack trace:
#0 [internal function]: Illuminate\Exception\Handler->handleError(2, 'file_get_conten...', '/var/www/sites/...', 29, Array)
#1 /var/www/site/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php(29): file_get_contents('/var/www/sites/...')
#2 /var/www/site/vendor/laravel/framework/src/Illuminate/Cache/FileStore.php(52): Illuminate\Filesystem\Filesystem->get('/var/www/sites/...')
#3 /var/www/site/vendor/laravel/framework/src/Illuminate/Cache/Repository.php(49): Illuminate\Cache\FileStore->get('9756dee4a3bf000...')
#4 /var/www/site/vendor/laravel/framework/src/Illuminate/Cache/Repository.php(37): Illuminate\Cache\Repository->get('9756dee4a3bf000...')
#5 /var/www/site/vendor/laravel/framework/src/Illuminate/Cache/Repository.php(80): Illuminate\Cache\Repository->has('9756dee4a3bf000...')
#6 [internal function]: Illuminate\Cache\Repository->remember('9756dee4a3bf000...', 60, Object(Closure))
[...]
From what I understand the cache file may be getting removed by another process in between the is_file and file_get_contents in the Filesystem class.
Maybe it's as simple as wrapping this part of the FileStore or Filesystem in a try/catch to be able to handle this case correctly?
Also wondering if this type of issue could happen with other drivers...
Metadata
Metadata
Assignees
Labels
No labels