Bug 1494230

Summary: java-1.8.0-openjdk: JVM crash with JIT compilation of commons-math3
Product: [Fedora] Fedora Reporter: Julien Nicoulaud <julien.nicoulaud>
Component: java-1.8.0-openjdkAssignee: Roland Westrelin <rwestrel>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 29CC: ahughes, dbhole, fweimer, jerboaa, julien.nicoulaud, jvanek, msrb, mvala, omajid, sgehwolf
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-10-05 09:16:27 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Attachments:
Description Flags
Reproducer program
none
coredumpctl info
none
hs_err.log
none
replay.log
none
core dump none

Description Julien Nicoulaud 2017-09-21 18:38:17 UTC
Created attachment 1329125 [details]
Reproducer program

Description of problem:
Executing a simple Java program that uses the Apache commons-math3 library leads to a JVM crash (segmentation fault). The crash seems to occur while JIT compiling commons-math3 classes. The bug could only be reproduced when using the Fedora package of OpenJDK.

Version-Release number of selected component (if applicable):
java-1.8.0-openjdk-1.8.0.144-5.b01.fc26

How reproducible:
Always

Steps to Reproduce:
1. Install JDK: sudo dnf install -y java-1.8.0-openjdk-devel
2. Get commons-math3 jar: wget https://repo1.maven.org/maven2/org/apache/commons/commons-math3/3.6.1/commons-math3-3.6.1.jar
3. Create Main.java source file (see attachements)
4. Compile program: javac -cp commons-math3-3.6.1.jar Main.java
5. Execute program: java -cp .:commons-math3-3.6.1.jar Main

Actual results:
The program crashes instantly with output:
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007f3a264d8b81, pid=805, tid=0x00007f3a0bdfd700
#
# JRE version: OpenJDK Runtime Environment (8.0_144-b01) (build 1.8.0_144-b01)
# Java VM: OpenJDK 64-Bit Server VM (25.144-b01 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# V  [libjvm.so+0x807b81]
#
# Core dump written. Default location: /home/vagrant/core or core.805
#
# An error report file with more information is saved as:
# /home/vagrant/hs_err_pid805.log
#
# Compiler replay data is saved as:
# /home/vagrant/replay_pid805.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
#

(see attachments for core/log files)

Expected results:
The program runs indefinitely.

Additional info:
Tested on several versions of Oracle JDK without reproducing:
- jdk1.8.0_25
- jdk1.8.0_40
- jdk1.8.0_45
- jdk1.8.0_65
- jdk1.8.0_92
- jdk1.8.0_101
- jdk1.8.0_102
- jdk1.8.0_111
- jdk1.8.0_112
- jdk1.8.0_121
- jdk1.8.0_131
- jdk1.8.0_141
- jdk1.8.0_144

Comment 1 Julien Nicoulaud 2017-09-21 18:39 UTC
Created attachment 1329126 [details]
coredumpctl info

Comment 2 Julien Nicoulaud 2017-09-21 18:39 UTC
Created attachment 1329127 [details]
hs_err.log

Comment 3 Julien Nicoulaud 2017-09-21 18:40 UTC
Created attachment 1329128 [details]
replay.log

Comment 4 Julien Nicoulaud 2017-09-21 18:40 UTC
Created attachment 1329129 [details]
core dump

Comment 5 Roland Westrelin 2017-09-22 13:12:54 UTC
While this doesn't crash with oracle's jdk, I can trigger a similar failure with a custom test case. Current jdk development branch is affected. Upstream bug:

https://bugs.openjdk.java.net/browse/JDK-8187822

One workaround is to run with: -XX:ConditionalMoveLimit=0

Comment 6 Fedora End Of Life 2018-05-03 08:43:51 UTC
This message is a reminder that Fedora 26 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 26. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '26'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 26 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 7 Jan Kurik 2018-08-14 10:17:53 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 29 development cycle.
Changing version to '29'.

Comment 8 Severin Gehwolf 2018-10-05 09:16:27 UTC
This should be fixed with java-1.8.0-openjdk-1.8.0.172-16.b11 and better. I for one, cannot longer reproduce it using Roland's upstream reproducer:

$ rpm -q java-1.8.0-openjdk
java-1.8.0-openjdk-1.8.0.181.b15-5.fc28.x86_64

$ java -XX:-TieredCompilation -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -XX:CICompilerCount=1 -XX:CompileCommand=dontinline,TestCMovSplitThruPhi::not_inlined -XX:CompileOnly=TestCMovSplitThruPhi::test -XX:-LoopUnswitching TestCMovSplitThruPhi
CompilerOracle: dontinline TestCMovSplitThruPhi.not_inlined
$ echo $?
0

It crashed with SEGV with an earlier build.

Thus, I'm closing this bug with resolution current release. F27, F28, F29, F30 should all be fixed. Please re-open if you can still reproduce the issue.