RFR: 8274136: -XX:+ExitOnOutOfMemoryError calls exit while threads are running

David Holmes dholmes at openjdk.java.net
Tue Sep 28 23:24:48 UTC 2021


On Fri, 24 Sep 2021 07:44:19 GMT, Thomas Stuefe <stuefe 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?

Thanks for the reviews @tstuefe  and @hseigel.

@tstuefe : personally I don't think printing the stack to stdout is a necessary thing to add.

-------------

PR: https://git.openjdk.java.net/jdk/pull/5668


More information about the hotspot-dev mailing list