JVM 崩溃 Failed to write core dump解决办法 WINDOWS

时间:2020-12-24 00:47:11

JVM 崩溃 Failed to write core dump解决办法 WINDOWS

MIT

key words: JVM,崩溃,windows,Failed,core dump,虚拟内存

最近从平台中分出了一个小项目,没有配置单独的服务器,而是需要部署到公司网站服务器(windows server)上去。

一共部署一个网站,一个设备通信服务jar

阿里云ECS 4G 内存,系统:windows server 2008 SP1 64位 未激活

一开始查看了下java环境变量,设置得非常乱,上面装了两个java,一个64位一个32位,但是path指向的都是32位的java。

通信服务jar能够顺利启动,不过隔三差五就挂掉,报JVM异常

tomcat 一开始启动就不顺利,重新设定了JAVA_HOME才启动,后来也没过几天又挂掉了,后来再也启动不了了。。。。。

当时直接在bin目录生成的日志hs_err_pid1234.log内容是:

#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (malloc) failed to allocate 32744 bytes for ChunkPool::allocate
# Possible reasons:
# The system is out of physical RAM or swap space
# In 32 bit mode, the process size limit was hit
# Possible solutions:
# Reduce memory load on the system
# Increase physical memory or swap space
# Check if swap backing store is full
# Use 64 bit Java on a 64 bit OS
# Decrease Java heap size (-Xmx/-Xms)
# Decrease number of Java threads
# Decrease Java thread stack sizes (-Xss)
# Set larger code cache with -XX:ReservedCodeCacheSize=
# This output file may be truncated or incomplete.
#
# Out of Memory Error (allocation.cpp:273), pid=2620, tid=4872
#
# JRE version: Java(TM) SE Runtime Environment (8.0_45-b15) (build 1.8.0_45-b15)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.45-b02 mixed mode windows-amd64 compressed oops)
# Failed to write core dump.
....以下省略超多jvm异常

不外乎说内存不够,64位的OS 没有用64位的java,减少java 线程数,等等之内的,但是我看了下任务管理器,线程数也不多,4G物理内存,才用了1.2G

没办法,只好把java全部卸载,重新安装64位版本的。重新设定JAVA_HOME和PATH,发挥JAVA最大功效。还是没好,然后又把盗版系统激活重新,还是没好

最后,我在通过运行DxDiag 查看系统信息时才发现问题:

一开始的System Information:

------------------
Time of this report: 12/15/2015, 13:54:13
Machine name: iZ23leuxxxxx
Operating System: Windows Server 2008 R2 Standard 64-bit (6.1, Build 7601) Service Pack 1 (7601.win7sp1_gdr.130708-1532)
Language: Chinese (Simplified) (Regional Setting: Chinese (Simplified))
System Manufacturer: Xen
System Model: HVM domU
BIOS: Revision: 1.221
Processor: Intel(R) Xeon(R) CPU E5-2430 0 @ 2.20GHz (2 CPUs), ~2.2GHz
Memory: 4096MB RAM
Available OS Memory: 4096MB RAM
Page File: 3908MB used, 184MB available
Windows Dir: C:\Windows
DirectX Version: DirectX 11
DX Setup Parameters: Not found
User DPI Setting: Using System DPI
System DPI Setting: 96 DPI (100 percent)
DWM DPI Scaling: Disabled
DxDiag Version: 6.01.7601.17514 32bit Unicode ------------

其中Page File: 3908MB used, 184MB available ,184M,太小了,然后到C盘查看隐藏文件,居然没发现pagefile.sys文件。

也就是没有设置虚拟内存。。。。。

设置完虚拟内存后:

Time of this report: 12/15/2015, 14:07:22
Machine name: iZ23leuxxxxx
Operating System: Windows Server 2008 R2 Standard 64-bit (6.1, Build 7601) Service Pack 1 (7601.win7sp1_gdr.130708-1532)
Language: Chinese (Simplified) (Regional Setting: Chinese (Simplified))
System Manufacturer: Xen
System Model: HVM domU
BIOS: Revision: 1.221
Processor: Intel(R) Xeon(R) CPU E5-2430 0 @ 2.20GHz (2 CPUs), ~2.2GHz
Memory: 4096MB RAM
Available OS Memory: 4096MB RAM
Page File: 4486MB used, 6703MB available
Windows Dir: C:\Windows
DirectX Version: DirectX 11
DX Setup Parameters: Not found
User DPI Setting: Using System DPI
System DPI Setting: 96 DPI (100 percent)
DWM DPI Scaling: Disabled
DxDiag Version: 6.01.7601.17514 32bit Unicode

再次启动tomcat,顺利启动,设备通信服务也没再挂过了