Skip to content

Commit b0b7ae9

Browse files
bug #47497 [Bridge] Fix mkdir() race condition in ProxyCacheWarmer (andrey-tech)
This PR was merged into the 4.4 branch. Discussion ---------- [Bridge] Fix mkdir() race condition in ProxyCacheWarmer | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix [#47489](#47489) | License | MIT | Doc PR | - The race condition is appears when several processes are attempting to create a same Doctrine Proxy directory which does not yet exist and `\RuntimeException` is thrown in `\Symfony\Bridge\Doctrine\CacheWarmer\ProxyCacheWarmer`. This PR adds an extra check to `\Symfony\Bridge\Doctrine\CacheWarmer\ProxyCacheWarmer`. Commits ------- cdb6c15 [Bridge] Fix mkdir() race condition in ProxyCacheWarmer
2 parents b96f1c4 + cdb6c15 commit b0b7ae9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Bridge/Doctrine/CacheWarmer/ProxyCacheWarmer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function warmUp($cacheDir)
4949
foreach ($this->registry->getManagers() as $em) {
5050
// we need the directory no matter the proxy cache generation strategy
5151
if (!is_dir($proxyCacheDir = $em->getConfiguration()->getProxyDir())) {
52-
if (false === @mkdir($proxyCacheDir, 0777, true)) {
52+
if (false === @mkdir($proxyCacheDir, 0777, true) && !is_dir($proxyCacheDir)) {
5353
throw new \RuntimeException(sprintf('Unable to create the Doctrine Proxy directory "%s".', $proxyCacheDir));
5454
}
5555
} elseif (!is_writable($proxyCacheDir)) {

0 commit comments

Comments
 (0)