最近一周左右,网管监控系统经常监控到tomcat异常退出,由于有检测tomcat pid的脚本,所以会自动重启服务器,查询tomcat日志没有报错信息,查询系统message日志,可以看到如下信息。
Dec 15 22:08:07 net-wap3 kernel: java[8299]: segfault at 00000000453caa98 rip 00002aaac4d055bd rsp 00000000453caa80 error 6
然后用nohup strace -p pid &> strace.log &将程序与内核之间传递的信号记录下来,记录下如下信息:
Process 9754 attached - interrupt to quit
futex(0x40b589d0, FUTEX_WAIT, 9762, NULL <unfinished ...>
+++ killed by SIGSEGV +++
可以看到是被11号信号kill的,然后我们需要得到程序退出时的corefile。
编辑/etc/profile将其中的ulimit -S -c 0 > /dev/null 2>&1改成ulimit -S -c unlimited > /dev/null 2>&1,然后source /etc/profile,用ulimit -c查看查看,将程序重启。
然后查看一下重启后的程序的pid,然后cat /proc/pid/limits,其中
Limit Soft Limit Hard Limit Units
Max core file size unlimited unlimited bytes
确定红色地方为unlimited,确保可以输出corefile,然后运行echo "/corefile/core_%p_%s_%t_%e" > /proc/sys/kernel/core_pattern,将corefile输出到/corefile下,%p代表pid,%s代表引起程序退出的信号,%t代表自1970年1月1日0时到程序退出时的秒数,%e代表可执行文件名,如我得到的文件core_29151_11_1387033918_java。
然后用gdb java core_29151_11_1387033918_java和jstack java core_29151_11_1387033918_java分析。
在jstack输出的结果中发现如下信息
- org.apache.jsp._480.mfb.zt.qc._30999750.index_jsp._jspService(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) @bci=1680, line=296 (Interpreted frame)
- org.apache.jasper.runtime.HttpJspBase.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) @bci=3, line=70 (Interpreted frame)
- javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse) @bci=30, line=717 (Compiled frame)
- org.apache.jasper.servlet.JspServletWrapper.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, boolean) @bci=320, line=377 (Compiled frame)
- org.apache.jasper.servlet.JspServlet.serviceJspFile(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.String, java.lang.Throwable, boolean) @bci=126, line=313 (Compiled frame)
- org.apache.jasper.servlet.JspServlet.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) @bci=347, line=260 (Compiled frame)
- javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse) @bci=30, line=717 (Compiled frame)
- org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) @bci=376, line=290 (Compiled frame)
- org.apache.catalina.core.ApplicationFilterChain.doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) @bci=101, line=206 (Compiled frame)
- com.wondertek.mobiletv.portal.webapp.filter.XSSServletFilter.doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse, javax.servlet.FilterChain) @bci=17, line=59 (Compiled frame)
- org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) @bci=119, line=235 (Compiled frame)
- org.apache.catalina.core.ApplicationFilterChain.doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) @bci=101, line=206 (Compiled frame)
- org.apache.catalina.core.ApplicationDispatcher.invoke(javax.servlet.ServletRequest, javax.servlet.ServletResponse, org.apache.catalina.core.ApplicationDispatcher$State) @bci=393, line=646 (Compiled frame)
- org.apache.catalina.core.ApplicationDispatcher.doInclude(javax.servlet.ServletRequest, javax.servlet.ServletResponse) @bci=260, line=551 (Compiled frame)
- org.apache.catalina.core.ApplicationDispatcher.include(javax.servlet.ServletRequest, javax.servlet.ServletResponse) @bci=55, line=488 (Compiled frame)
- sun.reflect.GeneratedMethodAccessor307.invoke(java.lang.Object, java.lang.Object[]) @bci=48 (Compiled frame)
- sun.reflect.DelegatingMethodAccessorImpl.invoke(java.lang.Object, java.lang.Object[]) @bci=6, line=25 (Compiled frame)
- java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) @bci=161, line=597 (Compiled frame)
- net.bull.javamelody.JspWrapper.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[]) @bci=85, line=151 (Compiled frame)
- net.bull.javamelody.JdbcWrapper$DelegatingInvocationHandler.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[]) @bci=7, line=282 (Compiled frame)
- $Proxy47.include(javax.servlet.ServletRequest, javax.servlet.ServletResponse) @bci=20 (Compiled frame)
- org.apache.jasper.runtime.JspRuntimeLibrary.include(javax.servlet.ServletRequest, javax.servlet.ServletResponse, java.lang.String, javax.servlet.jsp.JspWriter, boolean) @bci=45, line=968 (Interpreted frame)
- org.apache.jsp._480.mfb.zt.qc._30999750.index_jsp._jspService(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) @bci=1695, line=299 (Interpreted frame)
- org.apache.jasper.runtime.HttpJspBase.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) @bci=3, line=70 (Interpreted frame)
- javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse) @bci=30, line=717 (Compiled frame)
- org.apache.jasper.servlet.JspServletWrapper.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, boolean) @bci=320, line=377 (Compiled frame)
- org.apache.jasper.servlet.JspServlet.serviceJspFile(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.String, java.lang.Throwable, boolean) @bci=126, line=313 (Compiled frame)
- org.apache.jasper.servlet.JspServlet.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) @bci=347, line=260 (Compiled frame)
- javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse) @bci=30, line=717 (Compiled frame)
- org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) @bci=376, line=290 (Compiled frame)
- org.apache.catalina.core.ApplicationFilterChain.doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) @bci=101, line=206 (Compiled frame)
- com.wondertek.mobiletv.portal.webapp.filter.XSSServletFilter.doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse, javax.servlet.FilterChain) @bci=17, line=59 (Compiled frame)
- org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) @bci=119, line=235 (Compiled frame)
- org.apache.catalina.core.ApplicationFilterChain.doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse) @bci=101, line=206 (Compiled frame)
- org.apache.catalina.core.ApplicationDispatcher.invoke(javax.servlet.ServletRequest, javax.servlet.ServletResponse, org.apache.catalina.core.ApplicationDispatcher$State) @bci=393, line=646 (Compiled frame)
- org.apache.catalina.core.ApplicationDispatcher.doInclude(javax.servlet.ServletRequest, javax.servlet.ServletResponse) @bci=260, line=551 (Compiled frame)
- org.apache.catalina.core.ApplicationDispatcher.include(javax.servlet.ServletRequest, javax.servlet.ServletResponse) @bci=55, line=488 (Compiled frame)
- sun.reflect.GeneratedMethodAccessor307.invoke(java.lang.Object, java.lang.Object[]) @bci=48 (Compiled frame)
- sun.reflect.DelegatingMethodAccessorImpl.invoke(java.lang.Object, java.lang.Object[]) @bci=6, line=25 (Compiled frame)
- java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[]) @bci=161, line=597 (Compiled frame)
- net.bull.javamelody.JspWrapper.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[]) @bci=85, line=151 (Compiled frame)
- net.bull.javamelody.JdbcWrapper$DelegatingInvocationHandler.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[]) @bci=7, line=282 (Compiled frame)
- $Proxy47.include(javax.servlet.ServletRequest, javax.servlet.ServletResponse) @bci=20 (Compiled frame)
- org.apache.jasper.runtime.JspRuntimeLibrary.include(javax.servlet.ServletRequest, javax.servlet.ServletResponse, java.lang.String, javax.servlet.jsp.JspWriter, boolean) @bci=45, line=968 (Interpreted frame)
- org.apache.jsp._480.mfb.zt.qc._30999750.index_jsp._jspService(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) @bci=1695, line=299 (Interpreted frame)
- org.apache.jasper.runtime.HttpJspBase.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) @bci=3, line=70 (Interpreted frame)
- javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse) @bci=30, line=717 (Compiled frame)
- org.apache.jasper.servlet.JspServletWrapper.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, boolean) @bci=320, line=377 (Compiled frame)
- org.apache.jasper.servlet.JspServlet.serviceJspFile(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, java.lang.String, java.lang.Throwable, boolean) @bci=126, line=313 (Compiled frame)
- org.apache.jasper.servlet.JspServlet.service(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) @bci=347, line=260 (Compiled frame)
- javax.servlet.http.HttpServlet.service(javax.servlet.ServletRequest, javax.servlet.ServletResponse) @bci=30, line=717 (Compiled frame)
发现程序异常是由于上面的页面中存在循环导致,至此故障恢复。
- 用JDBC编程的执行时错误及其解决大全
用JDBC编程的执行时错误及其解决 用JDBC编程的执行时错误及其解决 源码: .java.lang.ClassNotFoundException: com.microsoft.jdbc.sqlser ...
- gcc编译通过,运行却显示“段错误”的解决方法
第一次在Liunx上(liunx mint 17)使用gcc编译c文件,竟然提示“找不到stdio.h",经过google后发现执行 sudo apt-get install build- ...
- 实战项目中Java heap space错误的解决
部标GPS通讯系统在上线之后,经过不断调试,终于稳定运行一段时间,后来又遇到了Java heap space错误异常!日志如下: 说明系统中有未释放的对象.如何找出这些未释放对象以及监控JVM堆内存, ...
- Java compiler level does not match the version of the installed java project facet错误的解决
因工作的关系,Eclipse开发的Java项目拷来拷去,有时候会报一个很奇怪的错误.明明源码一模一样,为什么项目复制到另一台机器上,就会报“java compiler level does not m ...
- HIVE-执行distribute by时报错的解决过程---之如何分析hive执行的错误并解决
在执行一条HIVE语句的时候报了以下错误,重新检查了所有步骤,重启所有服务,发现没有问题. 但发现一个有趣的事情 1,select sno,sname,sex,sage,sdept from stud ...
- java 执行sql错误 传入的表格格式数据流(TDS)远程过程调用(RPC)协议流不正确。参数 1 (""): 数据类型 0x38 未知
连接数据库时设置:Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE ,ResultSet.CONCUR_R ...
- java.lang.NumberFormatException 错误及解决办法
package com.geelou.test; public class ErrTest { public static void main(String[] args) { String numS ...
- 我的Android进阶之旅------>Android项目运行报java.lang.NoClassDefFoundError错误的解决办法
今天在运行一个Android项目的时候,报了以下错误: D/AndroidRuntime( 3859): Shutting down VM E/AndroidRuntime( 3859): FATAL ...
- java.lang.NumberFormatException错误及解决方法
java.lang.NumberFormatException 一般由Integer.valueOf(String param)或者Integer.parseInt(String param)引起 不 ...
随机推荐
- yii2.0中解决post的400错误
不想用gii的表单自己写表单,但是又遇到了400错误,怎么解决?下面为你解答一下:
- nefu 628 Garden visiting
//yy:想到昨天一个神题整了几个小时,最后按题解把p拆了用孙子定理..今天这个简单,把C暴力拆了.. 题目链接:nefu 628 Garden visiting 1 <= n, m, p &l ...
- ubuntu环境安装谷歌驱动命令
1.sudo apt-get install chromium-chromedriver. 2.直接下载:http://chromedriver.storage.googleapis.com/inde ...
- 用SQL实现的BASE64加密及解密函数(SQL2005以上有效)
CREATE FUNCTION [dbo].[f_base64_encode] (@bin varbinary(max)) returns varchar(max) as begin return c ...
- PHP-------MySQLi 的函数
MySQLi 的函数 在数据库中找到一张是自增长的科目表表就可以, Code主键值是自增长的,name是varchar类型的. 如果想往科目表里添加一条数据,是自增长列的表中添加数据,添加完之后,取添 ...
- c#根据当前时间获取本周,本月,本年度等时间段和DateTime日期格式化
DateTime dt = DateTime.Now; //当前时间 DateTime startWeek = dt.AddDays( - Convert.ToInt32(dt.DayOfWeek.T ...
- v-bind:的基本用法
1. v-bind:class(根据需求进行选择) <style> .box{ background-color: #ff0; } .textColor{ color: #000; } . ...
- shiro集成spring&工作流程&DelegatingFilterProxy
1.集成Spring 参考文献: 新建web工程: ehcache-core来自Hibernate wen.xml <?xml version="1.0" encoding= ...
- 富文本使用之wangEditor3
一.介绍: wangEditor —— 轻量级 web 富文本编辑器,配置方便,使用简单.支持 IE10+ 浏览器. 二.使用方式: 直接下载:https://github.com/wangfupen ...
- 课时47.datalist标签(了解)
1.datalist标签 作用:给输入框绑定待选项 2.datalist格式: <datalist> <option>待选项内容</option> </dat ...