JDK-8229994 : assert(false) failed: Bad graph detected in get_early_ctrl_for_expensive
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 11,14
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2019-08-21
  • Updated: 2022-06-27
  • Resolved: 2019-12-06
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 13 JDK 14
11.0.7-oracleFixed 13.0.4Fixed 14 b27Fixed
Related Reports
Relates :  
Description
Lucene tests failed with:
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (open/src/hotspot/share/opto/loopnode.cpp:155), pid=22447, tid=22505
#  assert(false) failed: Bad graph detected in get_early_ctrl_for_expensive
#
# JRE version: Java(TM) SE Runtime Environment (14.0+10) (fastdebug build 14-ea+10-332)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 14-ea+10-332, mixed mode, sharing, tiered, compressed oops, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0x11d91a0]  PhaseIdealLoop::get_early_ctrl_for_expensive(Node*, Node*)+0x7d0
#
# Core dump will be written. Default location: Core dumps may be processed with "/usr/share/apport/apport %p %s %c %d %P" (or dumping to /var/lib/jenkins/workspace/LuceneSolr/solr/build/solr-core/test/J0/core.22447)
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
#

---------------  S U M M A R Y ------------

Command Line: -ea -esa --illegal-access=deny -Dtests.prefix=tests -Dtests.seed=A0C9006A45309D75 -Xmx512M -Dtests.iters= -Dtests.verbose=false -Dtests.infostream=false -Dtests.codec=random -Dtests.postingsformat=random -Dtests.docvaluesformat=random -Dtests.locale=random -Dtests.timezone=random -Dtests.directory=random -Dtests.linedocsfile=europarl.lines.txt.gz -Dtests.luceneMatchVersion=8.2.1 -Dtests.cleanthreads=perClass -Djava.util.logging.config.file=/var/lib/jenkins/workspace/LuceneSolr/lucene/tools/junit4/logging.properties -Dtests.nightly=false -Dtests.weekly=false -Dtests.monster=false -Dtests.slow=true -Dtests.asserts=true -Dtests.multiplier=1 -DtempDir=./temp -Djava.io.tmpdir=./temp -Dcommon.dir=/var/lib/jenkins/workspace/LuceneSolr/lucene -Dclover.db.dir=/var/lib/jenkins/workspace/LuceneSolr/lucene/build/clover/db -Djava.security.policy=/var/lib/jenkins/workspace/LuceneSolr/lucene/tools/junit4/solr-tests.policy -Dtests.LUCENE_VERSION=8.2.1 -Djetty.testMode=1 -Djetty.insecurerandom=1 -Dsolr.directoryFactory=org.apache.solr.core.MockDirectoryFactory -Djava.awt.headless=true -Djdk.map.althashing.threshold=0 -Dtests.src.home=/var/lib/jenkins/workspace/LuceneSolr -Djava.security.egd=file:/dev/./urandom -Djunit4.childvm.cwd=/var/lib/jenkins/workspace/LuceneSolr/solr/build/solr-core/test/J0 -Djunit4.tempDir=/var/lib/jenkins/workspace/LuceneSolr/solr/build/solr-core/test/temp -Djunit4.childvm.id=0 -Djunit4.childvm.count=4 -Dfile.encoding=UTF-8 -Djava.security.manager=org.apache.lucene.util.TestSecurityManager -Dtests.filterstacks=true -Dtests.leaveTemporary=false com.carrotsearch.ant.tasks.junit4.slave.SlaveMainSafe -eventsfile /var/lib/jenkins/workspace/LuceneSolr/solr/build/solr-core/test/temp/junit4-J0-20190821_024914_68216438067453104669101.events @/var/lib/jenkins/workspace/LuceneSolr/solr/build/solr-core/test/temp/junit4-J0-20190821_024914_68215694935363344787111.suites -stdin

Host: lmesnik-linux, Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz, 8 cores, 31G, Ubuntu 18.04.3 LTS
Time: Wed Aug 21 03:35:08 2019 PDT elapsed time: 2752 seconds (0d 0h 45m 52s)

---------------  T H R E A D  ---------------

Current thread (0x00007f603c359000):  JavaThread "C2 CompilerThread0" daemon [_thread_in_native, id=22505, stack(0x00007f60124a4000,0x00007f60125a5000)]


Current CompileTask:
C2:2752790 54665       4       org.apache.lucene.search.similarities.TFIDFSimilarity::scorer (98 bytes)

Stack: [0x00007f60124a4000,0x00007f60125a5000],  sp=0x00007f601259ef30,  free space=1003k
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x11d91a0]  PhaseIdealLoop::get_early_ctrl_for_expensive(Node*, Node*)+0x7d0
V  [libjvm.so+0x11d96d2]  PhaseIdealLoop::set_early_ctrl(Node*)+0x12
V  [libjvm.so+0x11e63fe]  PhaseIdealLoop::dominated_by(Node*, Node*, bool, bool)+0x48e
V  [libjvm.so+0x11af98f]  PhaseIdealLoop::peeled_dom_test_elim(IdealLoopTree*, Node_List&)+0x1af
V  [libjvm.so+0x11aff6a]  PhaseIdealLoop::do_peeling(IdealLoopTree*, Node_List&)+0x5aa
V  [libjvm.so+0x11bba0b]  IdealLoopTree::iteration_split_impl(PhaseIdealLoop*, Node_List&)+0x1db
V  [libjvm.so+0x11bd111]  IdealLoopTree::iteration_split(PhaseIdealLoop*, Node_List&)+0x111
V  [libjvm.so+0x11bd026]  IdealLoopTree::iteration_split(PhaseIdealLoop*, Node_List&)+0x26
V  [libjvm.so+0x11bd06a]  IdealLoopTree::iteration_split(PhaseIdealLoop*, Node_List&)+0x6a
V  [libjvm.so+0x11e0bb7]  PhaseIdealLoop::build_and_optimize(LoopOptsMode)+0xd27
V  [libjvm.so+0x9c6b2a]  PhaseIdealLoop::optimize(PhaseIterGVN&, LoopOptsMode)+0x2ea
V  [libjvm.so+0x9c3bcd]  Compile::Optimize()+0xb2d
V  [libjvm.so+0x9c527f]  Compile::Compile(ciEnv*, C2Compiler*, ciMethod*, int, bool, bool, bool, DirectiveSet*)+0x109f
V  [libjvm.so+0x807cad]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, DirectiveSet*)+0x10d
V  [libjvm.so+0x9d1962]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0x2d2
V  [libjvm.so+0x9d2858]  CompileBroker::compiler_thread_loop()+0x3b8
V  [libjvm.so+0x16cac36]  JavaThread::thread_main_inner()+0x226
V  [libjvm.so+0x16d0276]  Thread::call_run()+0xf6
V  [libjvm.so+0x13ecede]  thread_native_entry(Thread*)+0x10e

Register to memory mapping:

RAX=0x00007f60435ab000 points into unknown readable memory: 58 00 00 00 00 00 00 00
RBX=0x00007f603d2e4608 points into unknown readable memory: d8 33 82 42 60 7f 00 00
RCX=0x00007f6042418bf8: <offset 0x0000000001973bf8> in /var/lib/jenkins/jdk/jdk-14/fastdebug/lib/server/libjvm.so at 0x00007f6040aa5000
RDX=0x00007f6042489ab9: <offset 0x00000000019e4ab9> in /var/lib/jenkins/jdk/jdk-14/fastdebug/lib/server/libjvm.so at 0x00007f6040aa5000
RSP=0x00007f601259ef30 is pointing into the stack for thread: 0x00007f603c359000
RBP=0x00007f601259eff0 is pointing into the stack for thread: 0x00007f603c359000
RSI=0x000000000000009b is an unknown value
RDI=0x00007f6042417d98: <offset 0x0000000001972d98> in /var/lib/jenkins/jdk/jdk-14/fastdebug/lib/server/libjvm.so at 0x00007f6040aa5000
R8 =0x0 is NULL
R9 =0x00007f603c35b1c0 points into unknown readable memory: 03 00 00 00 00 00 00 00
R10=0x0 is NULL
R11=0x0 is NULL
R12=0x00007f601259faf0 is pointing into the stack for thread: 0x00007f603c359000
R13=0x00007f603d3594d0 points into unknown readable memory: d8 33 82 42 60 7f 00 00
R14=0x000000000000001d is an unknown value
R15=0x00007f603d3b4250 points into unknown readable memory: e8 94 82 42 60 7f 00 00


Registers:
RAX=0x00007f60435ab000, RBX=0x00007f603d2e4608, RCX=0x00007f6042418bf8, RDX=0x00007f6042489ab9
RSP=0x00007f601259ef30, RBP=0x00007f601259eff0, RSI=0x000000000000009b, RDI=0x00007f6042417d98
R8 =0x0000000000000000, R9 =0x00007f603c35b1c0, R10=0x0000000000000000, R11=0x0000000000000000
R12=0x00007f601259faf0, R13=0x00007f603d3594d0, R14=0x000000000000001d, R15=0x00007f603d3b4250
RIP=0x00007f6041c7e1a0, EFLAGS=0x0000000000010246, CSGSFS=0x002b000000000033, ERR=0x0000000000000006
  TRAPNO=0x000000000000000e

Top of Stack: (sp=0x00007f601259ef30)
0x00007f601259ef30:   00007f6043593480 00007f60424d3988
0x00007f601259ef40:   00007f601259eff0 00007f603d3b4250
0x00007f601259ef50:   00007f603d3b426c 00007f603d3b4258
0x00007f601259ef60:   00007f603d3b4250 00007f6041c6fa27 

Instructions: (pc=0x00007f6041c7e1a0)
0x00007f6041c7e0a0:   3d f3 9c 79 00 48 8b 00 c6 00 58 31 c0 e8 2e 92
0x00007f6041c7e0b0:   8a ff e8 c9 b7 20 00 45 8b 7d 28 e9 2c fa ff ff
0x00007f6041c7e0c0:   48 8b 07 ff 50 10 84 c0 75 26 48 8b 45 c0 e9 af
0x00007f6041c7e0d0:   fe ff ff 0f 1f 44 00 00 31 d2 4c 89 ee 4c 89 ff
0x00007f6041c7e0e0:   e8 6b 34 1a 00 48 8b 45 c0 e9 7c fe ff ff 66 90
0x00007f6041c7e0f0:   41 83 fe 01 0f 84 4e 01 00 00 48 8b 45 c0 41 be
0x00007f6041c7e100:   01 00 00 00 e9 79 fe ff ff 0f 1f 80 00 00 00 00
0x00007f6041c7e110:   4c 89 eb e9 b3 fb ff ff 0f 1f 84 00 00 00 00 00
0x00007f6041c7e120:   48 8d 05 b9 d2 bd 00 48 8d 0d 13 0b 85 00 48 8d
0x00007f6041c7e130:   15 2a 0b 85 00 be 96 00 00 00 48 8d 3d 57 9c 79
0x00007f6041c7e140:   00 48 8b 00 c6 00 58 31 c0 e8 92 91 8a ff e8 2d
0x00007f6041c7e150:   b7 20 00 e9 3a f9 ff ff 0f 1f 84 00 00 00 00 00
0x00007f6041c7e160:   48 8b 95 58 ff ff ff 49 89 d8 4c 89 e9 4c 89 e7
0x00007f6041c7e170:   48 8d 35 81 aa 79 00 e8 34 f0 ff ff 48 8d 05 5d
0x00007f6041c7e180:   d2 bd 00 be 9b 00 00 00 48 8d 0d 69 aa 79 00 48
0x00007f6041c7e190:   8d 15 23 b9 80 00 48 8d 3d fb 9b 79 00 48 8b 00
0x00007f6041c7e1a0:   c6 00 58 31 c0 e8 36 91 8a ff e8 d1 b6 20 00 e9
0x00007f6041c7e1b0:   18 f9 ff ff 0f 1f 40 00 4c 89 fe 4c 89 ef e8 cd
0x00007f6041c7e1c0:   18 ff ff 49 89 c0 0f b7 40 30 83 e0 0f 66 83 f8
0x00007f6041c7e1d0:   08 74 41 48 8d 05 06 d2 bd 00 48 8d 0d 55 b9 80
0x00007f6041c7e1e0:   00 48 8d 15 18 a3 81 00 be 66 03 00 00 48 8d 3d
0x00007f6041c7e1f0:   fc b7 6a 00 4c 89 85 50 ff ff ff 48 8b 00 c6 00
0x00007f6041c7e200:   58 31 c0 e8 d8 90 8a ff e8 73 b6 20 00 4c 8b 85
0x00007f6041c7e210:   50 ff ff ff 31 f6 4c 89 c7 e8 12 94 17 00 48 85
0x00007f6041c7e220:   c0 0f 84 59 fa ff ff 4c 89 fe 4c 89 ef e8 5e 18
0x00007f6041c7e230:   ff ff 48 8d 70 1c 48 8d 78 08 e8 51 17 ff ff 44
0x00007f6041c7e240:   8b 78 28 e9 a4 f8 ff ff 48 8b 9d 50 ff ff ff e9
0x00007f6041c7e250:   2c fa ff ff 4c 89 ee ff d0 84 c0 0f 85 ff fd ff
0x00007f6041c7e260:   ff e9 c3 fd ff ff 48 8d 05 73 d1 bd 00 48 8d 3d
0x00007f6041c7e270:   4c 3e 6b 00 48 8d 0d 34 85 81 00 be a9 00 00 00
0x00007f6041c7e280:   48 8d 15 09 3e 6b 00 48 8b 00 c6 00 58 31 c0 e8
0x00007f6041c7e290:   4c 90 8a ff e8 e7 b5 20 00 49 8b 7f 28 e9 6d fd 


Stack slot to memory mapping:
stack at sp + 0 slots: 0x00007f6043593480 points into unknown readable memory: 40 00 00 00 00 00 00 00
stack at sp + 1 slots: 0x00007f60424d3988: <offset 0x0000000001a2e988> in /var/lib/jenkins/jdk/jdk-14/fastdebug/lib/server/libjvm.so at 0x00007f6040aa5000
stack at sp + 2 slots: 0x00007f601259eff0 is pointing into the stack for thread: 0x00007f603c359000
stack at sp + 3 slots: 0x00007f603d3b4250 points into unknown readable memory: e8 94 82 42 60 7f 00 00
stack at sp + 4 slots: 0x00007f603d3b426c points into unknown readable memory: 02 00 00 00
stack at sp + 5 slots: 0x00007f603d3b4258 points into unknown readable memory: a8 42 3b 3d 60 7f 00 00
stack at sp + 6 slots: 0x00007f603d3b4250 points into unknown readable memory: e8 94 82 42 60 7f 00 00
stack at sp + 7 slots: 0x00007f6041c6fa27: <offset 0x00000000011caa27> in /var/lib/jenkins/jdk/jdk-14/fastdebug/lib/server/libjvm.so at 0x00007f6040aa5000

Comments
Fix request (13u): The original change applies cleanly, passes tier1 and tier2 tests.
03-06-2020

Fix Request (11u) This fixes the C2 problem and keeps codebases in sync (I see 11.0.7-oracle). Patch does not apply cleanly. New test fails without the patch, passes with it. Patched JDK passes tier{1,2,3}. 11u RFR (reviewed by phh, chagedorn): https://mail.openjdk.java.net/pipermail/jdk-updates-dev/2020-February/002565.html
24-02-2020

URL: https://hg.openjdk.java.net/jdk/jdk/rev/4938269b8b17 User: thartmann Date: 2019-12-06 09:01:49 +0000
06-12-2019

http://cr.openjdk.java.net/~chagedorn/8229994/webrev.00/ As a part of loop peeling, loop-invariant dominating tests are moved out of the loop [1]. Doing so requires to change all control inputs coming from an independent test 'test' to data nodes inside the loop body to use the peeled version 'peeled_test' of 'test' instead [2]: the control test->data will be changed to peeled_test->data. If a data node is expensive then an assertion [3] checks the dominance relation of 'test' and 'peeled_test' ('peeled_test' should dominate 'test') but fails to find 'peeled_test' as part of the idom chain starting from the previous control input 'test' of that expensive node. The reason is that the idom information was not correctly set before at [4] after creating the peeled nodes. If 'head' (a CountedLoop node) has another OuterStripMinedLoop node, let's say 'outer_head', as an input then 'outer_head' is set as idom of 'head' instead of setting the idom of 'outer_head' to the new loop entry from the peeled iteration. We then miss all the idom information of the peeled iteration and the idom of 'outer_head' still points to the old loop entry node before peeling. The fix is straight forward to also account for loop strip mined loops when correcting the idom to the new loop entry from the peeled iteration at [4]. [1] http://hg.openjdk.java.net/jdk/jdk/file/99b71c5b02ff/src/hotspot/share/opto/loopTransform.cpp#l669 [2] http://hg.openjdk.java.net/jdk/jdk/file/99b71c5b02ff/src/hotspot/share/opto/loopopts.cpp#l271 [3] http://hg.openjdk.java.net/jdk/jdk/file/99b71c5b02ff/src/hotspot/share/opto/loopnode.cpp#l153 [4] http://hg.openjdk.java.net/jdk/jdk/file/99b71c5b02ff/src/hotspot/share/opto/loopTransform.cpp#l658
06-12-2019

Great, thank you!
25-09-2019

[~thartmann] I updated hs_err and replay.
25-09-2019

[~lmesnik], the attached hs_err file is wrong (it's for a "allocating handle inside NoHandleMark" failure). Would be good to also get the replay compilation file.
12-09-2019

Steps to reproduce: git clone --branch branch_8_2 https://github.com/apache/lucene-solr ant -autoproxy compile ant -autoproxy test Failure is intermittent, happened only once so far
21-08-2019