JDK-8244724 : CTW: C2 compilation fails with "Live Node limit exceeded limit"
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 11,15
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2020-05-11
  • Updated: 2024-11-13
  • Resolved: 2020-07-01
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 15 JDK 16
15 b30Fixed 16Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
$ cd test/hotspot/jtreg/testlibrary/ctw
$ make
$ cd dist
$ wget https://repo1.maven.org/maven2/org/bytedeco/javacpp/1.4/javacpp-1.4.jar
$ ./ctw.sh javacpp-1.4.jar

#  Internal Error (/home/shade/trunks/jdk-jdk/src/hotspot/share/opto/node.cpp:84), pid=9842, tid=9889
#  assert(Compile::current()->live_nodes() < Compile::current()->max_node_limit()) failed: Live Node limit exceeded limit
#
# JRE version: OpenJDK Runtime Environment (15.0) (fastdebug build 15-internal+0-adhoc.shade.jdk-jdk)
# Java VM: OpenJDK 64-Bit Server VM (fastdebug 15-internal+0-adhoc.shade.jdk-jdk, mixed mode, sharing, tiered, compressed oops, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0x1215334]  Node::verify_construction()+0x144

Current CompileTask:
C2:  18284 4552   !b  4       org.bytedeco.javacpp.Loader::findLibrary (1195 bytes)

Stack: [0x00007f2516feb000,0x00007f25170ec000],  sp=0x00007f25170e7430,  free space=1009k
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x1215334]  Node::verify_construction()+0x144
V  [libjvm.so+0x1216106]  Node::Node(unsigned int)+0x56
V  [libjvm.so+0x557233]  PhaseCFG::build_cfg()+0xc33
V  [libjvm.so+0x5579bc]  PhaseCFG::PhaseCFG(Arena*, RootNode*, Matcher&)+0x51c
V  [libjvm.so+0x85ce98]  Compile::Code_Gen()+0x238
V  [libjvm.so+0x863ddb]  Compile::Compile(ciEnv*, ciMethod*, int, bool, bool, bool, DirectiveSet*)+0xebb
V  [libjvm.so+0x6d58dc]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, DirectiveSet*)+0xfc
V  [libjvm.so+0x86ef8b]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0x2db
V  [libjvm.so+0x86ffc8]  CompileBroker::compiler_thread_loop()+0x538
V  [libjvm.so+0x166d706]  JavaThread::thread_main_inner()+0x206
V  [libjvm.so+0x1672566]  Thread::call_run()+0xf6

Logs:
 https://cr.openjdk.java.net/~shade/8244724/hs_err_pid9842.log
 https://cr.openjdk.java.net/~shade/8244724/replay_pid9842.log
Comments
URL: https://hg.openjdk.java.net/jdk/jdk15/rev/78c07dd72404 User: chagedorn Date: 2020-07-01 08:45:14 +0000
01-07-2020

http://cr.openjdk.java.net/~chagedorn/8244724/webrev.01/ The testcase contains many string concatinations. These are compiled by javac with -XDstringConcat=inline which creates a lot of StringBuilder objects and calls. As a result, we get a huge graph and eventually hit the live node limit assert during code generation when trying to create new nodes - either during PhaseCFG::build_cfg() or later in PhaseCFG::global_code_motion(). We could try to introduce estimates for them to bailout but that appears to be difficult to get right without being too pessimistic about it. But we need to be in order to avoid hitting the assert again by just modifying the testcase. Therefore, my suggestion is to completely skip the assert once the optimization phase is finished as we should not strictly care about the node limit anymore at this point in time and it does not really provide much help for finding bugs. A question remains, though, if we should also get rid of the remaining live node limit bailout checks in Compile::Code_Gen() like [1] as it appears to be a waste to go through all the optimization in the optimization phase to then bailout while generating code based only on the live node limit itself. I also updated "<" into "<=" in the live node limit assert because we should be allowed to reach the limit but not go beyond. [1] http://hg.openjdk.java.net/jdk/jdk/file/8fd3e34e8379/src/hotspot/share/opto/coalesce.cpp#l236
26-06-2020

Looks like JDK-8223030.
11-05-2020

ILW = Assert during C2 compilation due to running out of nodes, reproducible with CTW (never seen during normal execution), no other known workaround than to disable C2 compilation of affected method = HLM = P3
11-05-2020