1. 大量使用httpclient,遇到这个异常,还会导致我们的resin服务器自动重启:
A fatal error has been detected by the Java Runtime Environment:
SIGSEGV (0xb) at pc=0x00007fd211cbd1ee, pid=27875, tid=140532982884096
JRE version: 7.0_04-b20
Java VM: Java HotSpot(TM) 64-Bit Server VM (23.0-b21 mixed mode linux-amd64 compressed oops)
Problematic frame:
J org.apache.http.impl.cookie.BestMatchSpec.formatCookies(Ljava/util/List;)Ljava/util/List;
java.util.NoSuchElementException: null
at java.util.ArrayList$Itr.next(ArrayList.java:834) ~[na:1.7.0_51]
at org.apache.http.impl.cookie.BestMatchSpec.formatCookies(BestMatchSpec.java:175) ~[httpclient-4.3.jar:4.3]
at org.apache.http.client.protocol.RequestAddCookies.process(RequestAddCookies.java:174) ~[httpclient-4.3.jar:4.3]
at org.apache.http.protocol.ImmutableHttpProcessor.process(ImmutableHttpProcessor.java:131) ~[httpcore-4.3.jar:4.3]
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:192) ~[httpclient-4.3.jar:4.3]
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:85) ~[httpclient-4.3.jar:4.3]
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:108) ~[httpclient-4.3.jar:4.3]
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:186) ~[httpclient-4.3.jar:4.3]
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82) ~[httpclient-4.3.jar:4.3]
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:106) ~[httpclient-4.3.jar:4.3]
at module.laohu.commons.util.HttpClientUtil.invokePost(HttpClientUtil.java:209) [commons.laohu.module-2.2.jar:na]
at module.laohu.commons.util.HttpClientUtil.invokePost(HttpClientUtil.java:168) [commons.laohu.module-2.2.jar:na]
at com.general.sdk.channel.Nd91Handler.login(Nd91Handler.java:36) [Nd91Handler.class:na]
at com.general.sdk.channel.Channel.login(Channel.java:103) [Channel.class:na]
at com.general.sdk.manager.UserLoginManager.login(UserLoginManager.java:146) [UserLoginManager.class:na]
at com.general.sdk.controller.UserController.login(UserController.java:48) [UserController.class:na]
此异常是由于jdk JIT compiler optimization 导致,bug id 8021898,官网描述如下:
The JIT compiler optimization leads to a SIGSEGV or an NullPointerException at a place it must not happen.
jdk1.7.0_25到1.7.0_55这几个版本都存在此bug,1.7.0_60后修复。可通过升级jdk解决此异常。
reference:
http://bugs.java.com/view_bug.do?bug_id=8021898
https://issues.apache.org/jira/browse/HTTPCLIENT-1173
2. JVM崩溃-safepoint.cpp:308:
tomcat使用一天左右就崩溃一次,tomcat目录下产生一个hs_err * .log的日志文件,里面会记录导致JVM崩溃的信息,此次致命错误关键信息为【safepoint.cpp:308】,jdk版本从1.6更新到1.7解决