You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by sc...@apache.org on 2026/05/20 14:13:40 UTC

(beam) 01/01: Revert "[Java Portable SDK] Configure JVM so that it exits upon OutOfMemoryEr…"

This is an automated email from the ASF dual-hosted git repository.

scwhittle pushed a commit to branch revert-37764-exit_on_oom_jvm_option
in repository https://gitbox.apache.org/repos/asf/beam.git

commit 004700893d216a3e585f925463c94624dd9f8355
Author: Sam Whittle <sc...@users.noreply.github.com>
AuthorDate: Wed May 20 16:13:27 2026 +0200

    Revert "[Java Portable SDK] Configure JVM so that it exits upon OutOfMemoryEr…"
    
    This reverts commit 37ae1ffc176e56bc4e21bf989ffc7389bfbbdfa5.
---
 sdks/java/container/boot.go | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/sdks/java/container/boot.go b/sdks/java/container/boot.go
index 3ce79e4927e..ad29f8d940a 100644
--- a/sdks/java/container/boot.go
+++ b/sdks/java/container/boot.go
@@ -195,9 +195,6 @@ func main() {
 		"-XX:+UseParallelGC",
 		"-XX:+AlwaysActAsServerClassMachine",
 		"-XX:-OmitStackTraceInFastThrow",
-		// Crash and restart instead of throwing OutOfMemoryError which may be caught by user or
-		// framework code and leave things in a degraded state.
-        "-XX:+ExitOnOutOfMemoryError",
 	}
 
 	enableGoogleCloudProfiler := strings.Contains(options, enableGoogleCloudProfilerOption)
@@ -227,18 +224,16 @@ func main() {
 		args = append(args, jammAgentArgs)
 	}
 
-    enableHeapDumpsOnOom := false
 	// If heap dumping is enabled, configure the JVM to dump it on oom events.
 	if pipelineOptions, ok := info.GetPipelineOptions().GetFields()["options"]; ok {
 		if heapDumpOption, ok := pipelineOptions.GetStructValue().GetFields()["enableHeapDumps"]; ok {
-			enableHeapDumpsOnOom = heapDumpOption.GetBoolValue()
+			if heapDumpOption.GetBoolValue() {
+				args = append(args, "-XX:+HeapDumpOnOutOfMemoryError",
+					"-Dbeam.fn.heap_dump_dir="+filepath.Join(dir, "heapdumps"),
+					"-XX:HeapDumpPath="+filepath.Join(dir, "heapdumps", "heap_dump.hprof"))
+			}
 		}
 	}
-    if enableHeapDumpsOnOom {
-		args = append(args, "-XX:+HeapDumpOnOutOfMemoryError",
-			"-Dbeam.fn.heap_dump_dir="+filepath.Join(dir, "heapdumps"),
-			"-XX:HeapDumpPath="+filepath.Join(dir, "heapdumps", "heap_dump.hprof"))
-	}
 
 	// Apply meta options
 	const metaDir = "/opt/apache/beam/options"