我们有一个生产tomcat崩溃,它生成了一个hss_err_pid文件。这是其中的信息 -
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 19327352832 bytes for committing reserved memory.
# 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 (os_linux.cpp:2673), pid=12940, tid=140179071637248
根据我的理解,我们要看看它是不是RAM还是交换空间。但事实并非如此。这是top命令显示的内容 -
top - 10:14:58 up 4:44, 2 users, load average: 0.10, 0.14, 0.43
Tasks: 2737 total, 0 running, 2737 sleeping, 0 stopped, 0 zombie
Cpu(s): 5.9%us, 1.4%sy, 0.2%ni, 92.2%id, 0.1%wa, 0.0%hi, 0.3%si, 0.0%st
Mem: 32130824k total, 18671312k used, 13459512k free, 22892k buffers
Swap: 4194300k total, 0k used, 4194300k free, 180232k cached
Tomcat在分配的28 GB总量中消耗了17 GB。 Server也有32 GB的RAM。当我寻找类似的问题时,大多数都是因为分配给JVM的总xms超过了服务器所拥有的数量。而且没有其他运行的OS进程消耗更多的内存。是否有任何其他原因可以证明这个hs_err_pid日志文件的合理性?