Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

-XX:OnOutOfMemoryError="kill -9 %p" Problem

Tags:

java

jvm

jetty

I have an issue with trying to pass the -XX:OnOutOfMemoryError="kill -9 %p" command into my jvm args.

I am using Jetty7, and have this within the start.ini file. On start up it give me the error below. This is with jre /jre1.6.0_03l64

Starting Jetty: STARTED Jetty Tue Apr 26 09:54:26 EDT 2011
Unrecognized option: -9
Could not create the Java virtual machine.

The start.ini file is as below.

#=========================================================== # If the arguements in this file include JVM arguments # (eg -Xmx512m) or JVM System properties (eg com.sun.???), # then these will not take affect unless the --exec # parameter is included or if the output from --dry-run # is executed like: #   eval $(java -jar start.jar --dry-run) # # Below are some recommended options for Sun's JRE #-----------------------------------------------------------   --exec # -Dcom.sun.management.jmxremote   -Xmx4096m   -Xmn512m   -DLABEL=PROD_APP   -verbose:gc   -Xloggc:/export/opt/prod_app/logs/gc.log   -XX:OnOutOfMemoryError="kill -9 %p" # -XX:+PrintGCDateStamps   -XX:+PrintGCTimeStamps   -XX:+PrintGCDetails   -XX:+PrintTenuringDistribution # -XX:+PrintCommandLineFlags # -XX:+DisableExplicitGC # -XX:+UseConcMarkSweepGC # -XX:ParallelCMSThreads=2 # -XX:+CMSClassUnloadingEnabled # -XX:+UseCMSCompactAtFullCollection # -XX:CMSInitiatingOccupancyFraction=80 

Commenting the line out jetty will start fine with no issue. However we really need to add this arg due to memory leak with the system to prevent further damage if our process falls over.

Would anyone have any idea what I am doing wrong here or how I can fix this?

like image 801
Patrick Avatar asked Apr 26 '11 14:04

Patrick


People also ask

What is the another word for problem?

Some common synonyms of problem are enigma, mystery, puzzle, and riddle. While all these words mean "something which baffles or perplexes," problem applies to a question or difficulty calling for a solution or causing concern.

What of the meaning of problem?

A problem is a situation, question, or thing that causes difficulty, stress, or doubt. A problem is also a question raised to inspire thought. In mathematics, a problem is a statement or equation that requires a solution. Problem has a few other senses as a noun and an adjective.

What is a more positive word for problem?

Traditional euphemisms for "problems" are "challenges" or "opportunities". Puzzle is another positive way to view problems, especially homework problems.

What is problem and example?

The definition of a problem is something that has to be solved or an unpleasant or undesirable condition that needs to be corrected. An example of a problem is an algebra equation. An example of a problem is when it is raining and you don't have an umbrella. noun. 21.


1 Answers

In Java version 8u92 the VM arguments

  • -XX:+ExitOnOutOfMemoryError
  • -XX:+CrashOnOutOfMemoryError

were added, see the release notes.

ExitOnOutOfMemoryError
When you enable this option, the JVM exits on the first occurrence of an out-of-memory error. It can be used if you prefer restarting an instance of the JVM rather than handling out of memory errors.

CrashOnOutOfMemoryError
If this option is enabled, when an out-of-memory error occurs, the JVM crashes and produces text and binary crash files.

Enhancement Request: JDK-8138745 (parameter naming is wrong though JDK-8154713, ExitOnOutOfMemoryError instead of ExitOnOutOfMemory)

like image 123
flavio.donze Avatar answered Oct 16 '22 03:10

flavio.donze