-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
Hi KODUS,
Thank you for your library. I had a failure last night on mkdir($path).
ErrorException Warning: mkdir(): File exists mechanism generic handled false
This occurred in … /vendor/kodus/file-cache/src/FileCache.php in Kodus\Cache\FileCache::mkdir at line 380
if (!file_exists($parent_path)) {
$this->mkdir($parent_path); // recursively create parent dirs first
}
mkdir($path);
chmod($path, $this->dir_mode);
}
}By inspection, it takes time between file_exists($cache_path) and mkdir($path), especially if $parent_path is missing. If user A and user B are both racing to create this directory then mkdir can be called more than once. In this scenario this will raise an ErrorException warning Warning: mkdir(): File exists
if (! file_exists($cache_path) && file_exists(dirname($cache_path))) {
$this->mkdir($cache_path); // ensure that the parent path exists
}Metadata
Metadata
Assignees
Labels
No labels