Tomcat8使用OpenJDK.1.8.0_131关闭内存错误

时间:2017-05-08 05:30:02

标签: java apache tomcat memory

我正在尝试使用Tomcat8部署Web应用程序。当我在控制台中显示以下消息时关闭tomcat实例。

OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00000005c0000000, 6442450944, 0) failed; error='Cannot allocate memory' (errno=12)
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 6442450944 bytes for committing reserved memory.
# An error report file with more information is saved as:
# /home/my/path/project/apache-tomcat-8.0.28/bin/hs_err_pid7710.log
The stop command failed. Attempting to signal the process to stop through OS signal.
Tomcat stopped.

所以当我打开文件时,我可以找到以下声明。

---------------  P R O C E S S  ---------------

Java Threads: ( => current thread )

Other Threads:

=>0x00007f9e6000a000 (exited) JavaThread "Unknown thread" [_thread_in_vm, id=7711, stack(0x00007f9e69    497000,0x00007f9e69598000)]

VM state:not at safepoint (not fully initialized)

VM Mutex/Monitor currently owned by a thread:  ([mutex/lock_event])
[0x00007f9e60007f30] Heap_lock - owner thread: 0x00007f9e6000a000

GC Heap History (0 events):
No events

Deoptimization events (0 events):
No events

Internal exceptions (0 events):
No events

Events (0 events):
No events

VM state: not at safe point的含义是什么? 这是我执行java的命令。

VM Arguments:
jvm_args: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.net.preferIPv4Stack=true -Xms6144m -Xmx8192m -XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=512m -XX:+UseG1GC -Djava.awt.h    eadless=true -verbose:gc -Xloggc:/home/my/path/project/apache-tomcat-8.0.28/logs/gc.log -Djava    .library.path=/home/my/path/project/lib -Djava.endorsed.dirs=/home/my/path/project/apache-tomcat-8.0.28/endorsed -Dcatalina.base=/home/my/path/project/apache-tomcat-8.0.28 -Dcatalina.home=/home/my/path/project/apache-tomcat-8.0.28 -Djava.io.tmpdir=/home/my/path/project/apache-tomcat-8.0.28/temp
java_command: org.apache.catalina.startup.Bootstrap stop
java_class_path (initial): /home/my/path/project/apache-tomcat-8.0.28/bin/bootstrap.jar:/home/my/path/project/apache-tomcat-8.0.28/bin/tomcat-juli.jar
Launcher Type: SUN_STANDARD

我认为这对Web服务没有影响。可以忽略吗?

如何正确处理此错误?

FYI,

  • tomcat:8.0.28
  • jdk:OpenJDK.1.8.0_131
  • 操作系统:GNU/Linux x86_64

1 个答案:

答案 0 :(得分:1)

您的系统上的虚拟内存不足。您需要发布系统的内存配置。使用这些选项,您至少应拥有10 GB的物理内存。还有stop脚本的JVM选项和

的输出
free -m

使用您当前的选项

-Xmx8192m -XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=512m

单独使用Tomcat将使用超过8960 MB的虚拟内存(您必须添加代码缓存,堆栈和本机内存)。 stop脚本还需要额外的内存(希望你有不同的JVM选项),你的机器上的其他进程也是如此。交换JVM不是一个好主意,因为垃圾收集器经常在整个堆上运行。

  

什么VM状态:不是安全点意味着(原文如此)?

当执行状态为VM时,它们执行Java程序的具体要点。我建议Safepoints: Meaning, Side Effects and Overheads了解详情。