#110686ExistingTargetFolderException when processing folder is created by a parallel request
Description
ResourceStorage::getNestedProcessingFolder() catches ExistingTargetFolderException
since #96727. ResourceStorage::getProcessingFolder() has the same problem, but no
catch for it.
The code checks first, then creates:
if ($this->driver->folderExists($processingFolder) === false) {
$rootFolder = $this->getRootLevelFolder(false);
try {
$currentEvaluatePermissions = $this->evaluatePermissions;
$this->evaluatePermissions = false;
$this->processingFolder = $this->createFolder(
$processingFolder,
$rootFolder
);
Between folderExists() and createFolder() another request can create the same
folder. ResourceStorage::createFolder() then does its own check with
folderExistsInFolder() and throws ExistingTargetFolderException. The catch blocks
around this only handle \InvalidArgumentException,
InsufficientFolderWritePermissionsException and
ResourcePermissionsUnavailableException, so the exception goes up and the request
dies with a 500.
The second branch has the same race. If processingfolder points to another storage
(for example “1:processed”), the code calls $storage->hasFolder() and then
$storage->createFolder(). A fix for only one of the two branches leaves the other
one broken.
The driver itself is not the problem. LocalDriver::createFolder() uses mkdir_deep()
and is fine with an existing folder. Only the check in ResourceStorage throws.
How to reproduce:
Delete the processing folder (or use a fresh install / a new storage), then send
several requests at the same time that need image processing. One request creates
the folder, the others can get the exception.
Inside one request this does not happen. Images are processed one after another and
$this->processingFolder is cached in the object. It needs parallel requests.
Suggested fix, same idea as #96727: catch ExistingTargetFolderException and take the
folder that is already there.
Related: #96727
Reviews 2
Related issues 1
History 26
-
Gerrit Code Review pushed patch set 1 for main to change 95789 status
NewUnder Review <span data-processor="relativetime" data-value="2026-09-12T20:43:58+00:00" > 09/12/26, 20:43 </span> -
Simon Schaufelberger changed Related to #96727 <span data-processor="relativetime" data-value="2026-09-12T22:54:32+00:00" > 09/12/26, 22:54 </span>
-
Gerrit Code Review pushed patch set 2 for main to change 95789 <span data-processor="relativetime" data-value="2026-09-25T17:56:59+00:00" > 09/25/26, 17:56 </span>
-
Gerrit Code Review pushed patch set 3 for main to change 95789 <span data-processor="relativetime" data-value="2026-09-25T17:57:24+00:00" > 09/25/26, 17:57 </span>
-
Gerrit Code Review pushed patch set 1 for 14.3 to change 96090 <span data-processor="relativetime" data-value="2026-09-25T18:30:48+00:00" > 09/25/26, 18:30 </span>
-
Georg Ringer commented and changed status
Under ReviewResolved done0 %100 % <span data-processor="relativetime" data-value="2026-09-25T18:55:13+00:00" > 09/25/26, 18:55 </span>
Applied in changeset commit:971f1712a0b877c1f271f294e49612f7ea7c556d.