- 浏览: 24630 次
- 性别:
- 来自: 大连
-
文章分类
最新评论
Java Virtual Machine is a Native engine which allows our Java Applications to run. It performs the code optimization to improve the performance. In correct tuning, Low memory allocation, extensive code optimization, bad garbage collection strategy, API code leaking…etc are some of the reasons which may cause the JVM to crash.
.
Analyzing a JVM Crash is one of the very interesting and little time taking process sometimes it is even little complex to find out the root cause of the JVM Crash. Here in this article we will see some of the common mistakes, first aid solutions/debugging techniques to find out what kind of informations we can get by looking into the Core Dump.
======================================================================
What is Core Dump & Where to Find It?
Code dump is usually a Binary file which gets generated by the Operating System when JVM or any other process crashes. Sometimes it also happens that the JVM will not be able to generate the Crash dump. In Windows Operating Systems it will be generated in the Directore where the “Dr. Watson” tool is installed. In Windows it will be usually: ”C:\Documents and Settings\All Users\Application Data\Microsoft\Dr Watson“
.
By default in Unix based Operating Systems the Core Dump files are created in the directory where the Java Program/Server was started even sometimes it is generated in the “/tmp” directory of the Operating System. But using the following Java Option we can change it’s the Crash Dump/Heap Dump generation locations: -XX:HeapDumpPath=/opt/app/someLocaton/ and -XX:+HeapDump JVM Options.
.
NOTE: These Flags does not gurantee that always the Heap/Crash dump will be generated at the time of JVM Crash. There are some more reasons behind the Core Dump not gets generated…like Process Limitations or the Less Disk Quota or unavailability of the Free File Descriptors.
=======================================================================
Who Generates the Crash/Core Dump?
JVM does not generate the Coe dump. Rather it is the Operating System which generates the Core Dump. Core Dump is a Binary file which may be several hundred Mega Bytes or Giga Bytes in size. The Operating systems just log the exception/error messages and the details of the Threads along with the Native libraries loaded with that java process.
.
Many times a brief Textual Crash file is also generated by the JVM itself sometimes during Crash. Usually the file name is “hs_err_pid<WebLogicPID>.log” in case of Sun JDK. Similarly JRockit JVM also generates a Textual file with name “*.dump” in case of JVM Crash.
=======================================================================
Use of -XX:+ShowMessageBoxOnError?
The Thread Dump is also very helpful to analyze the Server Crash. Thread dump tells us what was the status and activities performed by the Threads at the time of crash. It may be possible to get a thread dump before the process exits. HotSpot supports the JAVA_OPTIONS -XX:+ShowMessageBoxOnError
.
The corresponding JRockit JVM Option is -Djrockit.waitonerror. When the JVM is crashing, it may prompt the user ” Do you want to debug the problem? ” This pauses the process, thereby creating an opportunity to generate a thread dump (a stack trace of every thread in the JVM), attach a debugger, or perform some other debugging activity. However, this does not work in all cases (for eg., in case of stack overflow).
.
Along with above there are various options available to get the Thread Dumps as described in : http://middlewaremagic.com/weblogic/?p=823
=======================================================================
What May Cause JVM Crash?
Reason-1). Usually Native Code causes the JVM Crash. Native code is a code written in Languages like C/C++, Java Native Interface APIs (JNI).
.
Reason-2). JDBC Drivers specially the Native Drivers.
.
Reason-3). JVM Code Optimization.
.
Reason-4). Less Memory availabity for Native Area of a Java Process.
.
Reason-5). Application Servers Native Performance Pack Libraries.
.
Reason-6). JVMs library itself can cause the Crash.
.
Reason-7). High CPU Utilization by the Threads. As described in : http://middlewaremagic.com/weblogic/?p=4348
.
Reason-8). Presence of Wrong Native Libraries in the PATH or in the “-Djava.library.path“
.
Reason-9). Presence of A Different Version of Libraries in “java.library.path” or in “SHLIB” or in “LD_LIBRARY_PATH” variables. Like setting a 64-bit version of Library in a 32-bit version of JVM’s library path or vise-versa.
=======================================================================
Tools To Analyze the Core Dumps?
Core/Crash dump is Operating System specific, So to analyze these Dumps we must use the Tools provided by the same Operating System vendors. Various kind of tools are provided by the Operating Systems to analyze these Core Dumps like:
Tool-1). Dr. Watson Tool in Windows OS. Windows OS Start (Button)—>Run…—>drwtsn32
.
Tool-2). “pstack” and “pmap” in Solaris Operating System.
.
Tool-3). “procstack” and “procmap” in AIX Operating System.
.
Tool-4). “lsstack” and “pmap” in Linux Operating System.
Tool-5). “pflag” if available in HP-UX Operating System.
=======================================================================
What May Help To Avoid JVM Crash?
It totally depends on What Caused the Crash or What Libraries caused the JVM crash to avoid the occurance of the JVM crash for next time. But following things should be taken in consideration while analyzing and avoiding the Crash.
.
Point-1). If the Native Jdbc Driver is causing issues, If our appliation is using the Native JDBC Drivers then Switching from Pure Native Jdbc Driver (Type-2 Drivers) to the Pure Java JDBC Driver (Type-4 Driver) may help.
.
Point-2). If the JVM Libraries are causing the Crash then Upgrading to a Later Version of the JDK. If that Application Server has that new JDK in it;s Supported Configuration list.
.
Point-3). If the JVM Code Optimization is causing the Crash, then Disabling the Code Optimization of JVM by applying the JVM Options.
For JRockit JVM Code Optimization can be disabled using JAVA_OPTION -Xnoopt
For Sun JDK Code Optimization can be disabled using JAVA_OPTION -Xint
.
Point-4). Some times the “Just In Time Compiler” code generation also causes the JVM Crash. In these scenarios In Case of Sun JDKs disabling the JIT Compiler can help. We can disable the JIT Compiler by adding the JVM Option: ”-Djava.compiler=none“
.
Point-5). Presence of a different bit version (32 bit or 64-bit libraries) of Library in the “-Djava.library.path“
.
Point-6). Disabling the Application Servers Native Performance Packs. In WebLogic The Native IO Can be disabled using “-Dweblogic.NativeIOEnabled=false” JVM Option.
.
发表评论
-
Weblogic Muxer Thread
2015-07-09 16:15 11031 Weblogic Muxer Sock ... -
How to find Oracle WebLogic Server Version ?
2015-01-12 00:40 550Use one of the following metho ... -
利用 Java dump 进行 JVM 故障诊断
2011-12-18 22:22 0引言对于大型 java 应用程序来说,再精细的测试都难以堵住所 ... -
weblogic v10.3配置nodemanager的"BAD_CERTIFICATE alert"的错误
2011-12-05 00:21 4140在使用weblogic 10.3自带的demo identit ... -
Weblogic - Socket Muxers in Thread Dumps
2011-11-24 00:29 2518原文:http://jojovedder.blogspot.c ... -
一次严重的WebLogic频繁宕机故障处理
2011-11-23 23:19 2042环境描述 AIX5308、WebLogic9.2 MP3集群( ... -
关于nohup
2011-11-18 13:54 994nohup 是一个Unix/Linux命令,表示no hang ... -
在Linux平台安装Oracle比较常见的问题
2011-11-06 21:42 18791. 不能启动安装界面 运行runInstaller提示信息 ...
相关推荐
JVM(Java Virtual Machine)是Java程序运行的核心组件,它负责解释和执行字节码。然而,当JVM出现严重错误或无法恢复的问题时,它可能会崩溃并生成一个崩溃日志,这通常被称为`hs_err_pid.log`文件。这篇内容将深入...
谈谈你对JVM的理解?
在分析日志时,我们需要关注是否有特定的错误提示,比如“OOME”(Out of Memory Error),然后根据提示检查JVM的启动参数,如堆大小设置`-Xms`和`-Xmx`是否合理,或者是否过度使用了持久代空间。同时,检查代码中...
23丨如何优化JVM内存分配?.html
"年轻代GC JVM crash"可能是因为在垃圾回收过程中遇到了严重问题,导致JVM崩溃。这可能是由于以下原因: 1. **内存溢出**:如果年轻代的空间不足以容纳新分配的对象,或者Survivor区无法容纳从Eden区晋升的对象,就...
互联网资讯,技术简介,IT、AI技术,人工智能
标题"JVM Crash,生成hs_err_pid.log文件"指的是Java虚拟机在运行过程中遇到了致命问题,导致其终止运行,并自动生成了一个错误日志文件。这个文件通常位于JVM崩溃时的工作目录下,文件名由“hs_err_pid”和进程ID...
JRE(Java Runtime Environment):它是Java运行环境,包括,java 运行的所需的类库+JVM(java 虚拟机)。 如果你不需要开发只需要运行Java程序,那么你可以安装JRE。例如程序员开发出的程序最终卖给了用户,用户不用...
那么到底什么是Java虚拟机(JVM)呢?通常我们谈论JVM时,我们的意思可能是: 对JVM规范的的比较抽象的说明; 对JVM的具体实现; 在程序运行期间所生成的一个JVM实例。 对JVM规范的的抽象说明是一些概念的集合,...
However, increasing the complexity of the language and improving the performance of the JVM created an opening for a new generation of programming languages. If you want to build a strong foundation...
【JVM面试题详解】 Java虚拟机(JVM)是Java平台的核心组成部分,它负责运行Java应用程序并提供跨平台的兼容性。对于Java开发者来说,深入理解JVM的工作原理是面试中不可或缺的一部分。以下是一些关于JVM的常见面试...
Java虚拟机(JVM)是Java程序运行的基础,它的调优是提高应用程序性能的关键环节。在JVM调优实践中,了解各个运行时数据区的工作原理至关重要。以下是对这些区域的详细解析: 1. **虚拟机栈**:每个线程都有一个...
A JVM Does That??? A JVM Does That???是 Cliff Click 在 Azul Systems 博客上分享的一篇技术文档,讨论了 JVM 的服务和功能。本文档中,Cliff Click 作为一名经验丰富的 JVM 工程师,对 JVM 的服务和功能进行了...
标题中提到了JVM原理、JVM调优、JVM内存模型和JAVA并发,这些都是Java虚拟机(JVM)相关的核心概念。JVM是运行Java字节码的虚拟计算机,为Java提供了一个跨平台的环境,确保Java程序可以在不同的操作系统上运行而...
Java虚拟机(JVM)是Java程序运行的核心,它负责解释和执行字节码,为Java应用程序提供了一个跨平台的运行环境。JDK(Java Development Kit)包含了开发和运行Java程序所需的所有工具,包括JVM。当我们谈论"jdk,jvm...
### JVM 详细介绍:掌握 JVM 的各个组成部分与功能 #### 一、Java 源文件编译及执行 Java 应用程序的核心在于源文件的编译与执行。不同于 C/C++ 这类需要针对不同平台进行编译的语言,Java 采用了一种更为灵活的...
安卓主机JVM J2ME加载器像J2ME-Loader + MascotCapsule Micro3D 跨平台(SDL,libretro) 托管JVM? ? ?跨平台(Java) 自定义(Java) – ? Bittboy,Miyoo(PocketGO) phoneME CDC phoneME高级 ? ...
什么是Java虚拟机(JVM)?——–回过头来看 博客说明 文章所涉及的资料来自互联网整理和个人总结,意在于个人学习和经验汇总,如有什么地方侵权,请联系本人删除,谢谢! 简介 Java虚拟机(Java Virtual Machine ...
Java虚拟机(JVM)是Java程序运行的基础,它是一个抽象的计算机系统,负责执行Java字节码。本文将深入探讨JVM的启动过程及其基本原理。 首先,我们需要理解JVM的基本概念。JVM是Java Virtual Machine的缩写,它是...