OOM when using S3TransferManager.downloadFile() #5744
Labels
bug
This issue is a bug.
investigating
This issue is being investigated and/or work is in progress to resolve the issue.
p2
This is a standard priority issue
Describe the bug
When we are downloading multiple files around 50 files of size around 500 Mb concurrently we're running into OOM issue and even when we reduced the MaxConcurrency of S3Client to as low as 5 we're still facing the issue.
Heap dump :
Regression Issue
Expected Behavior
S3TransferManager can work fine no matter how many files or how big the file is.
Current Behavior
Getting OOM for some of the threads due to which some files are not fully downloaded:
I Have also attached the full stack trace
StackTrace.txt
Reproduction Steps
i have also attached the dummy file link on which we reproduce issue.
Possible Solution
No response
Additional Information/Context
Initially we tried without any configuration but we got the issue so then i tried to setup the MaxConcurrency for the client and even when i reduced the value as slow as 5 we still got the OOM issue. It works fine when we reduced the concurrency to 1 or 2 but in that case i can see performance drop a lot. This is how we setup the MaxConcurrency:
Then we tried to reduce the
minimumPartSizeInBytes
from default 8 MB to 1 MB in that case i didn't receive any OOM issue but this reduces the performance. This is how we setup minimumPartSizeInBytes:If you see the heapdump snapshot most of the memory is consumed by the Byte[] class, accounting for approximately 99%. We are suspecting the issue arises because during the multipart download of a large file, the file is split into multiple smaller parts, all of which are held in memory, leading to excessive memory usage and that’s why when we reducing the minimum part size from 8MB to 1MB we’re no more getting this issue.
AWS Java SDK version used
2.25.64
JDK version used
openjdk version "17.0.13" 2024-10-15 LTS OpenJDK Runtime Environment Corretto-17.0.13.11.1 (build 17.0.13+11-LTS) OpenJDK 64-Bit Server VM Corretto-17.0.13.11.1 (build 17.0.13+11-LTS, mixed mode, sharing)
Operating System and version
Operating System: Amazon Linux, EC2 instance: c7gd.2xlarge
The text was updated successfully, but these errors were encountered: