JVM crash in JIT-compiled org.apache.http.impl.cookie.BestMatchSpec.formatCookies() method
Environment
- JBoss Enterprise Application Platform (EAP)
- 5.x
- 6.x
- Java 7
Issue
-
Our JBoss server crashes with the fatal error log containing:
# A fatal error has been detected by the Java Runtime Environment: # # SIGSEGV (0xb) at pc=0x00007f5b73e6d705, pid=31205, tid=140029100357376 # # Problematic frame: # J org.apache.http.impl.cookie.BestMatchSpec.formatCookies(Ljava/util/List;)Ljava/util/List; -
Using Apache http client libary in our application, we sporadically get the following exception:
Caused by: java.util.NoSuchElementException: at java.util.ArrayList$Itr.next(ArrayList.java:757) at org.apache.http.impl.cookie.BestMatchSpec.formatCookies(BestMatchSpec.java:189) at org.apache.http.client.protocol.RequestAddCookies.process(RequestAddCookies.java:196) at org.apache.http.protocol.ImmutableHttpProcessor.process(ImmutableHttpProcessor.java:108) at org.apache.http.protocol.HttpRequestExecutor.preProcess(HttpRequestExecutor.java:174) at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:462) at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:820) at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:754)
Resolution
Upgrade to JDK 1.7u60 or later, or JDK 8.
- As a work-around add one of the following:
-XX:-LoopUnswitching-XX:CompileCommand=exclude,org/apache/http/impl/cookie/BestMatchSpec,formatCookies
Root Cause
- This appears to be the issue that is generated by this Content from github.com is not included.reproducer or this Content from github.com is not included.reproducer.
- Content from issues.apache.org is not included.HTTPCLIENT-1173
- Content from bugs.sun.com is not included.JDK-8021898 : Broken JIT compiler optimization for loop unswitching
Components
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.