Fix busy-loop in withQueueLock() on non-EEXIST mkdir failure
If mkdir(queue.lock) failed for a reason other than "already exists" (e.g. a permissions or disk problem on the data directory), is_dir() was false, so the loop `continue`d before ever reaching the tries>=40 retry-limit check or the usleep(), spinning at full CPU forever instead of failing with a clear error. Move the staleness check inside an is_dir() guard instead of using continue to skip past the retry-limit logic, so the bounded-retry behavior applies regardless of why mkdir failed.
This commit is contained in:
@@ -1295,13 +1295,12 @@ final class BackupQueueService
|
||||
$tries = 0;
|
||||
while (!@mkdir($lockDir, 0700)) {
|
||||
$tries++;
|
||||
if (!is_dir($lockDir)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$mtime = (int)@filemtime($lockDir);
|
||||
if ($mtime > 0 && (time() - $mtime) > 120) {
|
||||
@rmdir($lockDir);
|
||||
if (is_dir($lockDir)) {
|
||||
$mtime = (int)@filemtime($lockDir);
|
||||
if ($mtime > 0 && (time() - $mtime) > 120) {
|
||||
@rmdir($lockDir);
|
||||
}
|
||||
}
|
||||
|
||||
if ($tries >= 40) {
|
||||
|
||||
Reference in New Issue
Block a user