Cloud Storage SDK: Attempting to upload files larger than Java heap space results in OOM
Maintainer antworten meist innerhalb von 1 Tag
@Dhriti07 arbeitet bereits daran.
Seit 30.8.2026.
Bewertung
Dieses Issue wurde noch nicht bewertet.
Beschreibung
Issue Details
Required: Provide a detailed description of the issue. Any additional information helps with figuring out the issue.
Example
I am seeing {ISSUE} when running X, Y... after doing Z. This behavior started after the X library upgrade a few weeks ago ...
Environment
Required: Provide details about your environment. If relevant, please also provide details about your GCP environment. The environment details MUST be filled out.
Provide the relevant details about your environment:
- OS: Fedora 44
- Java Version and JDK Vendor: Open JDK 17.0.17
- (If using GraalVM) GraalVM Version: N/A
(Optional) If deployed on GCP, provide the relevant details about your GCP deployment environment:
Storage test bench 0.54.0 running in podman
Dependencies
Required: Provide a list of the dependencies that are being used. If unable to provide the list, please list the relevant libraries shown below. One of the two sections below MUST be filled out.
Provide the versions of the relevant libraries:
- Libraries-Bom (com.google.cloud:libraries-bom): N/A
- (If not using Libraries-Bom) Client Libraries:
- Gax (gax / gax-grpc / gax-httpjson): 2.83.0
- Auth (google-auth-library-oauth2-http / google-auth-library-credentials): 1.50.0
- Any other relevant Java SDK dependencies:
- Google-Http-Java-Client (com.google.http-client:google-http-client): 2.2.0
Reproducer
Required: Provide a reproducer and the steps needed to reproduce this issue locally. If unable to provide a reproducer, please provide code snippets to help reproduce the issue. One of the two sections below MUST be filled out.
Provide as many code snippets as possible:
Example
Create transfer manager:
public GoogleStorageClient(StorageClientConfig clientConfig) {
config = new GoogleStorageClientConfig(clientConfig);
GoogleCredentials credentials = config.googleCredentials;
if(credentials instanceof AnonymousGoogleCredentials) {
storage = StorageOptions.newBuilder().setCredentials(credentials).setHost(clientConfig.getEndpointUrl())
.setTransportOptions(HttpTransportOptions.newBuilder().setConnectTimeout(GoogleCloudConfig.GOOGLE_REQUEST_TIMEOUT).build())
.setProjectId(config.projectId).build().getService();
} else {
storage = StorageOptions.newBuilder().setCredentials(credentials).setProjectId(config.projectId).setTransportOptions(HttpTransportOptions.newBuilder().setConnectTimeout(GoogleCloudConfig.GOOGLE_REQUEST_TIMEOUT).build()).build().getService();
}
transferManager = TransferManagerConfig.newBuilder().setAllowDivideAndConquerDownload(true).setAllowParallelCompositeUpload(true).setStorageOptions(storage.getOptions()).build().getService();
}
Same class
public uploadFiles(File[] sourceFiles, ) {
ParallelUploadConfig parallelUploadConfig = ParallelUploadConfig.newBuilder().setBucketName(bucketName).build();
List<UploadResult> results =
transferManager.uploadFiles(files, parallelUploadConfig).getUploadResults();
}
Create a client and attempt to upload a large file, larger than the JVM internal memory. I tested with a 3.2 GB file with 512 MB heap. The upload fails at the uploadFiles call with
Java heap spacecom.google.common.util.concurrent.ExecutionError: java.lang.OutOfMemoryError: Java heap space
at com.google.common.util.concurrent.Futures.wrapAndThrowUnchecked(Futures.java:1383)
at com.google.common.util.concurrent.Futures.getUnchecked(Futures.java:1376)
at com.google.api.gax.rpc.ApiExceptions.callAndTranslateApiException(ApiExceptions.java:53)
at com.google.cloud.storage.transfermanager.UploadJob.getUploadResults(UploadJob.java:57)
at com.ibm.cmus.google_cloud_storage.utils.client.GoogleStorageClient.uploadFiles(GoogleStorageClient.java:436)
I develop a tool which provides methods for interacting with various storage vendors (i.e. s3). I don't see other transfer managers struggling with memory and I am able to upload the same file without issues. While the simple fix is to increase heap space, as that size is obviously quite small, it is enough for other vendors to upload the same file.
Logs and Stack Trace
Required: Provide logs that showcase the error. This will help show the flow of the application and help narrow down the cause. Additionally, provide a stack trace of the error if possible.
FYI, the below link is broken, the troubleshooting guide appears to have been removed sometime in the last 2 years.
The Java SDK has a troubleshooting guide for enabling logs. This contains information regarding client-server communication, request and response details, and logging in dependency libraries. If using this guide, please obfuscate any private information (bearer tokens, request and response params, etc).
Additionally, please provide a stack trace of the error seen:
Exception
Java heap spacecom.google.common.util.concurrent.ExecutionError: java.lang.OutOfMemoryError: Java heap space
at com.google.common.util.concurrent.Futures.wrapAndThrowUnchecked(Futures.java:1383)
at com.google.common.util.concurrent.Futures.getUnchecked(Futures.java:1376)
at com.google.api.gax.rpc.ApiExceptions.callAndTranslateApiException(ApiExceptions.java:53)
at com.google.cloud.storage.transfermanager.UploadJob.getUploadResults(UploadJob.java:57)
at com.ibm.cmus.google_cloud_storage.utils.client.GoogleStorageClient.uploadFiles(GoogleStorageClient.java:436)
Behavior
Optional: Any additional information about the behavior of the error is helpful to debug.
Behavioral Questions:
- When did the issue begin? Is this behavior related to any dependency version upgrade? - I have not tested files of this size on older versions
- Is this behavior flaky? Or is this consistently seen in production? - This is consistently seen. The memory requirements for uploading files grow with file size.
- Is this behavior related to the volume of data? - No, but it is related to the size of the file.
- Vorherrschende Sprache
- Java
- Sterne
- 2.1k
- Forks
- 1.2k
- Ø Merge
- 2 T. 14 Std.
- Gemergte PRs (30 T.)
- 192
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus googleapis/google-cloud-java
-
[java-core] Timestamp.of(java.sql.Timestamp) is one second late for a time less than a second before the epochEvtl. vergeben @Vcode2407 hat das vor 4 Tagen übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
googleapis/google-cloud-java#14636 ·
Maintainer antworten meist innerhalb von 1 Tag
-
[java-firestore] UserDataConverter encodes a pre-epoch Date with negative nanos, so the write is refusedEvtl. vergeben @wu-hui hat das vor 23 Tagen übernommen. Offenpriority: p2 type: bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
googleapis/google-cloud-java#14635 · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
[java-firestore] UserDataConverter throws IndexOutOfBoundsException on an empty __binary__ valueEvtl. vergeben @wu-hui hat das vor 23 Tagen übernommen. Offenpriority: p2 type: bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
googleapis/google-cloud-java#14634 · 1 Kommentar · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
[java-firestore] CustomClassMapper.convertBigDecimal calls .abs() on Double, unintentionally flipping negative values to positiveEvtl. wieder frei @wu-hui hat das vor 45 Tagen übernommen, und es ist kein Pull Request offen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
googleapis/google-cloud-java#14533 · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
Github CI failing when trying to install xmllintEvtl. vergeben @blakeli0 hat das vor 81 Tagen übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
googleapis/google-cloud-java#14132 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in googleapis/google-cloud-java
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 80/100
finos/fluxnova-bpm-platform#387 ·
Maintainer antworten meist innerhalb von 4 Tagen
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 88/100
-
Schwierigkeit 2/5 Unter einer Stunde Anfängerfreundlichkeit 84/100
cpp-best-practices/project_validator#251 ·
Maintainer antworten meist innerhalb von 1 Tag
-
backend enhancement
Schwierigkeit 2/5 Ein halber Tag Anfängerfreundlichkeit 70/100
damodharg6/payledger#16 ·
-
[Bug]: An initiative list with no current entry logs an error on every changeEvtl. vergeben @dwizard0 hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
Maintainer antworten meist innerhalb von 1 Tag