-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[AEM 6.5] Asset share : Downloads limited to < 2147483647 bytes (2.147GB) due to int type #1115
Comments
Sounds reasonable! Care to make a PR? |
After further review, this isn't the only problem trying to support large files. Because of the extensive use of ByteArrayOutputStream throughout asset share downloads, it will require a significant rewrite that uses more memory friendly types. |
@wt-jking where/how exactly are you seeing this error? I uploaded a 2.8 GB files and can direct download it (the original rendition), as well as add it to a zip file for download. I am testing this on the AEM SDK locally right now. My content length header is coming back with |
@davidjgonzalez Interesting indeed. Our use case was to support up to 6GB. I was first getting a NumberFormatException on the code I commented on, then after patching that, we are getting JDK OOM errors because during the zip step, it's trying to read the entire file into memory. Our file is an MXF mov (5.3GB) video with two other renditions (mp4 and webm). I'd be happy to connect with you more on this, as we still haven't found a solution to this (trying to avoid rewriting the whole download package if possible) |
@wt-jking im grabbing a 9GB file right now (taking some time to download)... Few thoughts. Im fairly certain the ByteArrayOutputSteam can handle more than INT.MAX bytes (even tho tho the size is in bytes). I believe the limit is more on your heap size (since it would create it in memory) which would explain the OOM - if you dont have enough mem for the JVM to handle all the bits in memory. Few questions:
It sounds like if we can just change that setHeader(..) call to set a Long, instead of a Int, whatever is calling that in AEM (i dont see this method called in ASC) wouldnt fail on a number exception. You'd still have memory constraints (assuming your on AEM 6.5; AEM CS uses AEM's download framework which is more robust). I think we could do something like: |
I don't think it's quite that simple, casting a Long to an int will result in an invalid content-length value. I'm not sure the browser would complain or not. Relevant Stack trace before fix
After fix, this is the stack trace with the OOM issue. Note, I'm testing when using Author in preview mode. It's failing in AssetRenditionStreamerImpl on this line
|
@wt-jking IIUC there are 2 issues here:
What version of Java are you running? IIRC since 11? heapspace is automatically allocated based on overall free memory. If youre on Java i believe you still specify the max heap space. Curious as to what your settings are, and how much system/free memory you have when you hit this. I was able to zip a 9GB file on my local -- but im on Java11 and 32GB memory. |
Test setup in my local
It is worth noting, that we are running an older version of asset-share-commons (2.1.10). You think we'd have better results running the latest? I didn't see any code changes in 2 years in the download package. i agree from what I saw in the codebase, the zipping would require a rewrite, which is why I originally closed this. We're hoping to find another solution leveraging brand portal, but if we do end up making this work for our needs, we'll be sure to share that with this project. We are limited to AMS hosting only due to client requirements. |
What version of AEM 6.5? Also, im a shocked youre running out of heap on a 2GB file w/ a 16GB heap... on a local, which ostensibly is doing very little else. FWIW - though i dont think it would cause this - OpenJDK isnt supported. downloads.experiencecloud.adobe.com has Oracle JDK downloads if you want. |
@wt-jking also - curious - if you goto AEM Authors > Assets > and select this 2GB file and another smaller file (or maybe its renditions) to download ... does that work? AFIAK this ASC zipper/streamer should ~work the same (in terms of mem footprint) as AEM 6.5/BP |
I'm testing with a 5GB file locally. My version is Installed Products I'm able to download any combination of assets from author > assets without issue. We are certain it doesn't work the same as asset share. PS - we just learned of a 4GB limit with brand portal as well, so this may our only option to support large file downloads. |
Same result with Oracle JDK 11. |
@wt-jking ok - im seeing the same on 6.5.14 w/ latest ASC ... Agree this is going to be a bit of work to resolve as it starts to leak into the Rendition Dispatchers as well. I think the problem is the path through the Zipper -> Streamer -> Rendition Dispatcher ends up copying the streams around rather than just streaming it through... but because of the reliance on Sling includes, it's tricky to understand exactly what's going on under the covers ... (atleast without a deep dive .. been awhile since i looked at the AEM 6.5 set download code) |
When you have a file > 2.147 GB, this class will throw a NumberFormatException. We're trying to add large file download support for a client and ran into this issue. An alternative would be to use BigInteger or Long when calculating the content-length header.
asset-share-commons/core/src/main/java/com/adobe/aem/commons/assetshare/content/renditions/download/impl/AssetRenditionDownloadResponse.java
Line 73 in f973dbe
https://github.com/adobe/asset-share-commons/blob/develop/core/src/main/java/com/adobe/aem/commons/assetshare/content/renditions/download/impl/AssetRenditionDownloadResponse.java#L102
The text was updated successfully, but these errors were encountered: