ADDITIONAL SYSTEM INFORMATION :
openjdk version "25.0.1" 2025-09-16
A DESCRIPTION OF THE PROBLEM :
On posix operating systems it seems that the OnOutOfMemoryError hook is hardcoded to invoke "/bin/sh -c" as wrapper: https://github.com/openjdk/jdk/blob/6b72b778039afce0e25986114d15dd29a6786529/src/hotspot/os/posix/os_posix.cpp#L2110-L2111
This prevents usage of this feature when no shell is available, for example in hardened container images.
It would be more flexible to be able to directly specify a binary to be executed, at least using special syntax or a different flag like OnOutOfMemoryErrorExec
openjdk version "25.0.1" 2025-09-16
A DESCRIPTION OF THE PROBLEM :
On posix operating systems it seems that the OnOutOfMemoryError hook is hardcoded to invoke "/bin/sh -c" as wrapper: https://github.com/openjdk/jdk/blob/6b72b778039afce0e25986114d15dd29a6786529/src/hotspot/os/posix/os_posix.cpp#L2110-L2111
This prevents usage of this feature when no shell is available, for example in hardened container images.
It would be more flexible to be able to directly specify a binary to be executed, at least using special syntax or a different flag like OnOutOfMemoryErrorExec