Java 8 在使用内存爆了以后会发生什么?hs_err_pid 日志如何看?
问题:
Java进程被终止了,然后在应用的目录中发现了hs_err_pid日志。
运维反馈,结论是内存不够了
之前一直运行没有问题,没什么新增访问量,为什么会内存溢出,进程被killer掉类?
1.第一反应看日志:
hs_err_pid,内容如下:
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 65536 bytes for committing reserved memory.
# Possible reasons:
# The system is out of physical RAM or swap space
# The process is running with CompressedOops enabled, and the Java Heap may be blocking the growth of the native heap
# Possible solutions:
# Reduce memory load on the system
# Increase physical memory or swap space
# Check if swap backing store is full
# Decrease Java heap size (-Xmx/-Xms)
# Decrease number of Java threads
# Decrease Java thread stack sizes (-Xss)
# Set larger code cache with -XX:ReservedCodeCacheSize=
# JVM is running with Unscaled Compressed Oops mode in which the Java heap is
# placed in the first 4GB address space. The Java Heap base address is the
# maximum limit for the native heap growth. Please use -XX:HeapBaseMinAddress
# to set the Java Heap base and to place the Java Heap above 4GB virtual address.
# This output file may be truncated or incomplete.
#
# Out of Memory Error (os_linux.cpp:2798), pid=15490, tid=0x00007f47859bc700
#
# JRE version: OpenJDK Runtime Environment (8.0_262-b10) (build 1.8.0_262-b10)
# Java VM: OpenJDK 64-Bit Server VM (25.262-b10 mixed mode linux-amd64 compressed oops)
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
# --------------- T H R E A D --------------- Current thread (0x00007f47b4196800): JavaThread "C2 CompilerThread0" daemon [_thread_in_vm, id=15500, stack(0x00007f47858bd000,0x00007f47859bd000)] Stack: [0x00007f47858bd000,0x00007f47859bd000], sp=0x00007f47859b85a0, free space=1005k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [libjvm.so+0xb5718d] VMError::report_and_die()+0x15d
V [libjvm.so+0x50675a] report_vm_out_of_memory(char const*, int, unsigned long, VMErrorType, char const*)+0xaa
V [libjvm.so+0x93d3f8] os::pd_commit_memory(char*, unsigned long, unsigned long, bool)+0xd8
V [libjvm.so+0x93457e] os::commit_memory(char*, unsigned long, unsigned long, bool)+0x2e
V [libjvm.so+0xb53d94] VirtualSpace::expand_by(unsigned long, bool)+0x1b4
V [libjvm.so+0x61d15c] CodeHeap::expand_by(unsigned long)+0x6c
V [libjvm.so+0x48e0e6] CodeCache::allocate(int, bool)+0x46
V [libjvm.so+0x4865db] BufferBlob::create(char const*, int)+0x8b
V [libjvm.so+0x48b0e1] CodeBuffer::initialize(int, int)+0x21
V [libjvm.so+0x951a62] Compile::init_buffer(unsigned int*)+0x212
V [libjvm.so+0x959201] Compile::Output()+0x351
V [libjvm.so+0x4ae738] Compile::Code_Gen()+0x4e8
V [libjvm.so+0x4b23ce] Compile::Compile(ciEnv*, C2Compiler*, ciMethod*, int, bool, bool, bool)+0x116e
V [libjvm.so+0x407e88] C2Compiler::compile_method(ciEnv*, ciMethod*, int)+0x1d8
V [libjvm.so+0x4b9cb2] CompileBroker::invoke_compiler_on_method(CompileTask*)+0x8d2
V [libjvm.so+0x4ba980] CompileBroker::compiler_thread_loop()+0x510
V [libjvm.so+0xafe902] JavaThread::thread_main_inner()+0x212
V [libjvm.so+0x93a382] java_start(Thread*)+0xf2
C [libpthread.so.0+0x7ea5] start_thread+0xc5 Current CompileTask:
C2:859196826 31212 4 org.hibernate.engine.query.spi.HQLQueryPlan::<init> (382 bytes) --------------- P R O C E S S --------------- Java Threads: ( => current thread )
用jcmd -l 查看JVM 参数如下:
输入:
sudo -u gitlab-runner jcmd 28102 help
VM.native_memory
ManagementAgent.stop
ManagementAgent.start_local
ManagementAgent.start
VM.classloader_stats
GC.rotate_log
Thread.print
GC.class_stats
GC.class_histogram
GC.heap_dump
GC.finalizer_info
GC.heap_info
GC.run_finalization
GC.run
VM.uptime
VM.dynlibs
VM.flags
VM.system_properties
VM.command_line
VM.version
help
输入:
sudo -u gitlab-runner jcmd 28102 VM.command_line
VM Arguments:
jvm_args: -Xms1200m -Xmx1200m
java_command: xxx.jar --spring.profiles.active=prod
java_class_path (initial): xxxxxx.jar
Launcher Type: SUN_STANDARD
而物理机的内存为:
3.8G
现在的疑惑是内存在没什么访问的情况下,究竟为什么会内存爆掉?内存泄漏?
(未完待续)
Java 8 在使用内存爆了以后会发生什么?hs_err_pid 日志如何看?的更多相关文章
- java的GC与内存泄漏
从诞生至今,20多年过去,Java至今仍是使用最为广泛的语言.这仰赖于Java提供的各种技术和特性,让开发人员能优雅的编写高效的程序.今天我们就来说说Java的一项基本但非常重要的技术内存管理 了解C ...
- 死磕内存篇 --- JAVA进程和linux内存间的大小关系
运行个JAVA 用sleep去hold住 package org.hjb.test; public class TestOnly { public static void main(String[] ...
- JAVA基础知识点:内存、比较和Final
1.java是如何管理内存的 java的内存管理就是对象的分配和释放问题.(其中包括两部分) 分配:内存的分配是由程序完成的,程序员需要通过关键字new为每个对象申请内存空间(基本类型除外),所有的对 ...
- java程序运行时内存分配详解 (转)
转自:http://www.tuicool.com/articles/uU77v2 一. 基本概念 每运行一个java程序会产生一个java进程,每个java进程可能包含一个或者多个线程,每一个Ja ...
- [转]使用Java Mission Control进行内存分配分析
jdk7u40自带了一个非常好用的工具,就是Java Mission Control.JRockit Misson Control用户应该会对mission control的很多功能十分熟悉,JRoc ...
- Java是如何管理内存的?
本文转自CSDN用户Kevin涂腾飞的文章java内存管理机制:http://blog.csdn.net/tutngfei1129287460/article/details/7383480 JAVA ...
- Java虚拟机学习 - 体系结构 内存模型
一:Java技术体系模块图 二:JVM内存区域模型 1.方法区 也称"永久代” .“非堆”, 它用于存储虚拟机加载的类信息.常量.静态变量.是各个线程共享的内存区域.默认最小值为16MB,最 ...
- 方法:Linux 下用JAVA获取CPU、内存、磁盘的系统资源信息
CPU使用率: InputStream is = null; InputStreamReader isr = null; BufferedReader brStat = null; StringTok ...
- Java宝典(四)------Java中也存在内存泄露。
--Java中会存在内存泄露吗? --如果你想当然的以为Java里有了垃圾回收机制就不会存在内存泄露,那你就错了. Java里也会存在内存泄露! 我们慢慢来分析. 所谓内存泄露就是指一个不再被程序使用 ...
- java中三种常见内存溢出错误的处理方法
更多 10 相信有一定java开发经验的人或多或少都会遇到OutOfMemoryError的问题,这个问题曾困扰了我很长时间,随着解决各类问题经验的积累以及对问题根源的探索,终于有了一个比较深入的 ...
随机推荐
- DP经典例题——LIS&LCS
DP经典例题--LIS&LCS LCS 最长公共子序列,英文缩写为LCS(Longest Common Subsequence).其定义是,一个序列 S ,如果分别是两个或多个已知序列的子序列 ...
- 使用Git提交代码
目录 1.提交前准备工作 2.代码提交步骤 3.从git上面拉代码 4.Git变更集 5.参考资料 1.提交前准备工作 首先去git官网下载git工具(Git GUI Here.Git Bash He ...
- day01-ES6新特性
ES6新特性 1.ES6是什么? DCMAScript 6.0(以下简称ES6)是JavaScript语言的下一代标准,2015年6月发布 ES6设计目标:达到JavaScript语言可以用来编写复杂 ...
- [WPF]使用Fody提高效率
下载安装及使用 代码实例 public class Person:INotifyPropertyChanged { public event PropertyChangedEventHandler P ...
- 2023牛客寒假算法基础集训营3 A-I+K
A 题解 知识点:贪心. 把所有正偶数除成奇数,即可. (人傻了没加 \(x>0\) WA2 时间复杂度 \(O(n)\) 空间复杂度 \(O(1)\) 代码 #include <bits ...
- 遗传算法求TSP问题
一.实验内容及目的 本实验以遗传算法为研究对象,分析了遗传算法的选择.交叉.变异过程,采用遗传算法设计并实现了商旅问题求解,解决了商旅问题求解最合适的路径,达到用遗传算法迭代求解的目的.选择.交叉.变 ...
- 多线程之Semaphore登录限流示例
public static void main(String[] args) { //允许最大的登录数 int slots=10; ExecutorService executorService = ...
- Grafana 系列文章(十四):Helm 安装Loki
前言 写或者翻译这么多篇 Loki 相关的文章了, 发现还没写怎么安装 现在开始介绍如何使用 Helm 安装 Loki. 前提 有 Helm, 并且添加 Grafana 的官方源: helm repo ...
- 基于Apache Hudi 构建Serverless实时分析平台
NerdWallet 的使命是为生活中的所有财务决策提供清晰的信息. 这涵盖了一系列不同的主题:从选择合适的信用卡到管理您的支出,到找到最好的个人贷款,再到为您的抵押贷款再融资. 因此,NerdWal ...
- Java的两个好用的工具包 Apache commons
Apache commons 介绍 这是apache commons lang3的工具类的截图 这个工具,小皮一般用在业务层较多 这是apache commons codec下面的工具 这个工具包,今 ...