RFR: 8274136: -XX:+ExitOnOutOfMemoryError calls exit while threads are running
Thomas Stuefe
stuefe at openjdk.java.net
Fri Sep 24 07:46:53 UTC 2021
On Thu, 23 Sep 2021 23:15:28 GMT, David Holmes <dholmes at openjdk.org> wrote:
> Please see bug report for more detailed discussion.
>
> We introduce `os::_exit()` to `call _exit()` to allow us to terminate without running the at_exit handlers and global destructors, which lead to the crashes during termination.
>
> Testing: tiers 1-3 (includes the ExitOnOutOfMemoryError test)
>
> Thanks,
> David
LGTM.
Your assumption that `-XX:+ExitOnOutOfMemoryError` should stop the VM painlessly is what I think too. Our customers use it in scenarios where the VM should go down, quickly, with a minimum of fuzz. E.g. in cloud scenarios, where you want to restart the VM as fast as possible. OTOH, `-XX:+CrashOnOutOfMemoryError` should give you a hs-err file and a core, creating either may hang or at least delay matters.
Incidentally, in our SapMachine we added some subtle behavioral changes (https://github.com/SAP/SapMachine/wiki/Handling-of-OnOutOfMemoryError-switches-in-the-SapMachine, see italics). I know we talked about handling Thread exhaustion events, but what about simple stack printing to stdout, do you think that would be useful upstream?
-------------
Marked as reviewed by stuefe (Reviewer).
PR: https://git.openjdk.java.net/jdk/pull/5668
More information about the hotspot-dev
mailing list