JDK-8321204 : C2: assert(false) failed: node should be in igvn hash table
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 11,17,21,22,23
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2023-12-01
  • Updated: 2024-06-10
  • Resolved: 2024-05-20
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 23
23 b18Fixed
Related Reports
Duplicate :  
Relates :  
Relates :  
Description
The following test failed in the JDK22 CI:

serviceability/jvmti/vthread/premain/AgentWithVThreadTest.java

Here's a snippet from the log file:

 2566  CastPP  === 277 75  [[ 332 ]]  #java/util/concurrent/ConcurrentHashMap (java/io/Serializable,java/util/Map,java/util/concurrent/ConcurrentMap) * extra types: {0:java/util/concurrent/ConcurrentHashMap (java/io/Serializable,java/util/Map,java/util/concurrent/ConcurrentMap):NotNull *} strong dependency  Oop:java/util/concurrent/ConcurrentHashMap (java/io/Serializable,java/util/Map,java/util/concurrent/ConcurrentMap) * !orig=[330] !jvms: ConcurrentHashMap::transfer @ bci:119 (line 2451)
 2567  CastPP  === 572 96  [[ 2528 ]]  #narrowoop: java/util/concurrent/ConcurrentHashMap$Node (java/util/Map$Entry) *[int:>=0] (java/lang/Cloneable,java/io/Serializable) * extra types: {0:narrowoop: java/util/concurrent/ConcurrentHashMap$Node (java/util/Map$Entry) *[int:>=0] (java/lang/Cloneable,java/io/Serializable):NotNull * (speculative=narrowoop: java/util/concurrent/ConcurrentHashMap$Node (java/util/Map$Entry) *[int:>=0] (java/lang/Cloneable,java/io/Serializable):NotNull:exact * (inline_depth=2))} strong dependency !orig=[2525] !jvms: ConcurrentHashMap::transfer @ bci:286 (line 2479)
 2568  CastPP  === 572 75  [[ 2528 ]]  #java/util/concurrent/ConcurrentHashMap (java/io/Serializable,java/util/Map,java/util/concurrent/ConcurrentMap) * extra types: {0:java/util/concurrent/ConcurrentHashMap (java/io/Serializable,java/util/Map,java/util/concurrent/ConcurrentMap):NotNull *} strong dependency  Oop:java/util/concurrent/ConcurrentHashMap (java/io/Serializable,java/util/Map,java/util/concurrent/ConcurrentMap) * !orig=[2524] !jvms: ConcurrentHashMap::transfer @ bci:286 (line 2479)
 2571  CastPP  === 572 122  [[ 2528 ]]  #narrowoop: java/util/concurrent/ConcurrentHashMap$Node (java/util/Map$Entry) *[int:>=0] (java/lang/Cloneable,java/io/Serializable) * extra types: {0:narrowoop: java/util/concurrent/ConcurrentHashMap$Node (java/util/Map$Entry) *[int:>=0] (java/lang/Cloneable,java/io/Serializable):NotNull * (speculative=narrowoop: java/util/concurrent/ConcurrentHashMap$Node (java/util/Map$Entry) *[int:>=0] (java/lang/Cloneable,java/io/Serializable):NotNull:exact * (inline_depth=2))} strong dependency !orig=[2184] !jvms: ConcurrentHashMap::transfer @ bci:835 (line 2556)

erroneous node:
 1669  CheckCastPP  === 787 122  [[ 1680 1672 ]]  #narrowoop: java/util/concurrent/ConcurrentHashMap$Node (java/util/Map$Entry) *[int:>=0] (java/lang/Cloneable,java/io/Serializable) * (speculative=narrowoop: java/util/concurrent/ConcurrentHashMap$Node (java/util/Map$Entry) *[int:>=0] (java/lang/Cloneable,java/io/Serializable):NotNull:exact * (inline_depth=2)) !jvms: ConcurrentHashMap::setTabAt @ bci:16 (line 769) ConcurrentHashMap::transfer @ bci:524 (line 2513)
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/opt/mach5/mesos/work_dir/slaves/0db9c48f-6638-40d0-9a4b-bd9cc7533eb8-S9727/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/1d6ddd57-1d54-42e6-9e30-de0cf9cd6984/runs/351ce9aa-3534-44ef-9871-1a02b65a033e/workspace/open/src/hotspot/share/opto/compile.cpp:4929), pid=554535, tid=554551
#  assert(false) failed: node should be in igvn hash table
#
# JRE version: Java(TM) SE Runtime Environment (22.0+27) (fastdebug build 22-ea+27-2156)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 22-ea+27-2156, mixed mode, tiered, compressed oops, compressed class ptrs, g1 gc, linux-aarch64)
# Problematic frame:
# V  [libjvm.so+0x8c6908]  Compile::remove_speculative_types(PhaseIterGVN&) [clone .part.0]+0x9c8
#
# Core dump will be written. Default location: Core dumps may be processed with "/opt/core.sh %p" (or dumping to /opt/mach5/mesos/work_dir/slaves/0db9c48f-6638-40d0-9a4b-bd9cc7533eb8-S10314/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/f2cdc390-4963-4503-ae56-73d3c828108d/runs/58798190-eb32-4a2e-b757-88d1782b5ddc/testoutput/test-support/jtreg_open_test_hotspot_jtreg_hotspot_loom/scratch/3/core.554535)
#
# An error report file with more information is saved as:
# /opt/mach5/mesos/work_dir/slaves/0db9c48f-6638-40d0-9a4b-bd9cc7533eb8-S10314/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/f2cdc390-4963-4503-ae56-73d3c828108d/runs/58798190-eb32-4a2e-b757-88d1782b5ddc/testoutput/test-support/jtreg_open_test_hotspot_jtreg_hotspot_loom/scratch/3/hs_err_pid554535.log
[thread 554558 also had an error]

------ Timeout during error reporting after 120 s. ------
# [ timer expired, abort... ]
----------System.out:(1/53)----------

Here's the crashing thread's stack:

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

Current thread (0x0000ffff84304bf0):  JavaThread "C2 CompilerThread0" daemon [_thread_in_native, id=554551, stack(0x0000ffff55009000,0x0000ffff55207000) (2040K)]


Current CompileTask:
C2:958  559 % !   4       java.util.concurrent.ConcurrentHashMap::transfer @ 96 (849 bytes)

Stack: [0x0000ffff55009000,0x0000ffff55207000],  sp=0x0000ffff55201e20,  free space=2019k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x8c6908]  Compile::remove_speculative_types(PhaseIterGVN&) [clone .part.0]+0x9c8  (compile.cpp:4929)
V  [libjvm.so+0x8e04bc]  Compile::Optimize()+0x31c  (compile.cpp:4907)
V  [libjvm.so+0x8e36f0]  Compile::Compile(ciEnv*, ciMethod*, int, Options, DirectiveSet*)+0x14a0  (compile.cpp:857)
V  [libjvm.so+0x739860]  C2Compiler::compile_method(ciEnv*, ciMethod*, int, bool, DirectiveSet*)+0x17c  (c2compiler.cpp:134)
V  [libjvm.so+0x8eef74]  CompileBroker::invoke_compiler_on_method(CompileTask*)+0x7e0  (compileBroker.cpp:2299)
V  [libjvm.so+0x8efb5c]  CompileBroker::compiler_thread_loop()+0x598  (compileBroker.cpp:1958)
V  [libjvm.so+0xd6d8a8]  JavaThread::thread_main_inner()+0xe4  (javaThread.cpp:720)
V  [libjvm.so+0x159c910]  Thread::call_run()+0xac  (thread.cpp:220)
V  [libjvm.so+0x130f6ac]  thread_native_entry(Thread*)+0x12c  (os_linux.cpp:787)
C  [libpthread.so.0+0x7928]  start_thread+0x188
Comments
[jdk22u-fix-request] Approval Request from Martin The assertion has been hit several times in JDK 22. This backport fixes the assertion. It is very small, applies cleanly and tier 1-4 has passed. It only has an effect on debug builds.
07-06-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk22u/pull/245 Date: 2024-06-06 10:02:56 +0000
06-06-2024

Changeset: d1aad712 Author: Tobias Hartmann <thartmann@openjdk.org> Date: 2024-04-08 07:30:31 +0000 URL: https://git.openjdk.org/jdk/commit/d1aad71209092013a89b3b85a258dd4d2e31224a
08-04-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk/pull/18647 Date: 2024-04-05 07:45:20 +0000
05-04-2024

Nice catch! That could indeed explain the quite rare and non-reproducible cases we've observed in recent months and years.
04-04-2024

After eyeballing the logs and the code for a while, I suspect that this is an extremely rare case where Node::hash is 0 which is equivalent to Node::NO_HASH and we therefore return false from NodeHash::hash_delete. Hardcoding the hash value to 0 will immediately trigger this: uint ConstraintCastNode::hash() const { - return TypeNode::hash() + (int)_dependency + (_extra_types != nullptr ? _extra_types->hash() : 0); + return 0; }
04-04-2024

I checked the newest failures but the replay files are either not available or don't reproduce the issue. Update: And with another one from 2024-02-06. No luck.
04-04-2024

I tried the replay file from the latest failure but it does not reproduce the issue.
09-01-2024

Most likely similar to JDK-8312134 but now we have more debugging information in the log (since JDK-8312218). ILW = Same as JDK-8312134 = P4
04-12-2023