CrashOnOutOfMemoryError

CrashOnOutOfMemoryError

本文介绍了-XX:OnOutOfMemoryError =" kill -9%p"问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在尝试将 -XX:OnOutOfMemoryError =kill -9%p命令传递到我的jvm args时出现问题。

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

我正在使用Jetty7,并在start.ini文件中使用它。在启动时,它给出了下面的错误。这是jre /jre1.6.0_03l64

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

start.ini文件如下。

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

评论码头的线路将开始没有问题。但是我们真的需要添加这个arg,因为系统内存泄漏,以防止进一步损坏,如果我们的过程失败。

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?

推荐答案

在Java版本8u92中,VM参数

In Java version 8u92 the VM arguments


  • -XX:+ ExitOnOutOfMemoryError

  • -XX: + CrashOnOutOfMemoryError

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

已添加,请参阅。

CrashOnOutOfMemoryError

如果启用此选项,当发生
内存不足错误时, JVM崩溃并生成text和
二进制崩溃文件。

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

增强请求:(参数命名错误,但, ExitOnOutOfMemoryError 而不是 ExitOnOutOfMemory

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

这篇关于-XX:OnOutOfMemoryError =" kill -9%p"问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-16 01:34