gpt4 book ai didi

java - Tomcat8 关闭内存错误与 OpenJDK.1.8.0_131

转载 作者:行者123 更新时间:2023-11-28 22:16:52 25 4
gpt4 key购买 nike

我正在尝试使用 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

我看起来对网络服务没有影响。可以忽略吗?

如何正确处理这个错误?

仅供引用,

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

最佳答案

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

的输出
free -m

根据您当前的选择

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

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

What VM state: not at safe point means (sic)?

当执行状态为 VM 已知时,它们在执行 Java 程序时的特定点。我推荐Safepoints: Meaning, Side Effects and Overheads了解详情。

关于java - Tomcat8 关闭内存错误与 OpenJDK.1.8.0_131,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43840370/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com