Closed
Description
I sometimes get this warning :
request.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\ContextErrorException: "Warning: mkdir(): File exists" at [...]/symfony/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php line 45 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\ContextErrorException(code: 0): Warning: mkdir(): File exists at [...]/symfony/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php:45)"} []
This happens when calling multiple Symfony web pages at the same time, while Symfony just had its cache cleared.
Actually this code is not atomic :
if (!is_dir($this->folder)) {
mkdir($this->folder, 0777, true);
}
Nothing prevents the directory from being created twice.
It is not a big issue, since the error will happen only if profiler is enabled, and at most once after each cache:clear
.