0

I have a Java application run under this Java version: openjdk version "1.8.0_162" OpenJDK Runtime Environment (build 1.8.0_162-8u162-b12-1~deb9u1-b12) OpenJDK 64-Bit Server VM (build 25.162-b12, mixed mode) and I have option -XX:+ExitOnOutOfMemoryError specified on the command line. However recently I had OOME scenario where I see OOME in the logs: java.lang.OutOfMemoryError: unable to create new native thread

, but the application happily continues to work, without exiting. Looks like the option is completely ignored in this scenario. I am not sure what caused the OOME yet, but why could the JVM ignore the exit option? Is there anything that can be done to ensure if OOME happens the application does exit?

3
  • Try to make a minimal reproducible example of this so you can verify this actually happens the way you think it happens. Commented Apr 23, 2018 at 21:57
  • @pvg unfortunately, it's very hard to do since this application is a big Java server app, and the only think I know so far is that when OOM happens, it should exit, and it doesn't. I don't think simulating it on other Java code is going to help much. I am more interested in suggestions why ExitOnOutOfMemoryError may fail to do its job. Commented Apr 23, 2018 at 22:01
  • It's going to help if you can actually reproduce non-exit on your particular JVM. That can be done with a tiny amount of code. Commented Apr 23, 2018 at 22:35

2 Answers 2

1

Looks like it is a known JVM issue. Appears not to be fixed yet.

Sign up to request clarification or add additional context in comments.

Comments

1

You can use the jvmkill JVMTI agent to terminate the JVM when unable to allocate memory or create a new native thread.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.