-
Type: Bug
-
Status: Resolved
-
Priority: Critical
-
Resolution: Fixed
-
Affects Version/s: 9.10, 10.1
-
Component/s: Automation
When requesting an asynchronous download using the Blob.BulkDownload, it generates a download key that will be used afterward to check the async download's status and download the blob when ready.
The problem is the download key computation is based on the modification datetime of the blobs to include in the ZIP file and the user requesting the async download, which does not make the key unique if 2 (or more) async download requests for the same blob(s) are submitted simultaneously.
How to reproduce:
- Fire up a Nuxeo 9.10
- create workspace /default-domain/workspaces/
NXP-25068and create 3 File documents in it named File1, File2, File3, with a different attached blob for each of them - unzip attached ZIP file NXP-25068.zip in a work directory
- launch script
NXP-25068_loop.sh
The NXP-25068_loop.sh launches 10 simultaneous bulk downloads that should contain the 3 File documents created earlier.
expected result: 10 ZIP files containing the blobs attached to the 3 File documents File1, File2 and File3 are created in the current directory.
actual result: only a few ZIP files contain the blobs attached to the 3 File documents File1, File2 and File3, the other ZIP files are actually an HTML error page.
The scripts require the tool jq to parse the JSON, you easily replace it with python command.
The following modification solved the problem:
diff --git a/nuxeo-features/nuxeo-automation/nuxeo-automation-core/src/main/java/org/nuxeo/ecm/automation/core/operations/blob/BulkDownload.java b/nuxeo-features/nuxeo-automation/nuxeo-automation-core/src/main/java/org/nuxeo/ecm/automation/core/operations/blob/BulkDownload.java index a95238f..c693f4c 100644 --- a/nuxeo-features/nuxeo-automation/nuxeo-automation-core/src/main/java/org/nuxeo/ecm/automation/core/operations/blob/BulkDownload.java +++ b/nuxeo-features/nuxeo-automation/nuxeo-automation-core/src/main/java/org/nuxeo/ecm/automation/core/operations/blob/BulkDownload.java @@ -87,7 +87,7 @@ public class BulkDownload { } // Rendered documents might differ according to current user sb.append(session.getPrincipal().getName()); - return DigestUtils.md5Hex(sb.toString()); + return DigestUtils.md5Hex(sb.toString()) + new Long(System.currentTimeMillis()).toString(); } @OperationMethod