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

Abacn pushed a commit to branch release-2.74
in repository https://gitbox.apache.org/repos/asf/beam.git


The following commit(s) were added to refs/heads/release-2.74 by this push:
     new b4d33c59f8b [Cherrypick] Configure JVM so that it exits upon 
OutOfMemoryError originating in JVM (#38567) (#38582)
b4d33c59f8b is described below

commit b4d33c59f8b102ffb3e43ba3f5217a0f1684d852
Author: Vitaly Terentyev <[email protected]>
AuthorDate: Fri May 22 17:48:38 2026 +0400

    [Cherrypick] Configure JVM so that it exits upon OutOfMemoryError 
originating in JVM (#38567) (#38582)
---
 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"

Reply via email to