JDK-8305339 : fatal error: meet not symmetric
  • Type: Bug
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 21
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • Submitted: 2023-03-31
  • Updated: 2023-05-08
  • Resolved: 2023-05-08
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 21
21Resolved
Related Reports
Duplicate :  
Description
=== Meet Not Symmetric ===
t   =                   java/lang/Object *
this=                   java/lang/Class (java/io/Serializable,java/lang/constant/Constable,java/lang/reflect/AnnotatedElement,java/lang/invoke/TypeDescriptor,java/lang/reflect/GenericDeclaration,java/lang/reflect/Type,java/lang/invoke/TypeDescriptor$OfField):NotNull:exact *
mt=(t meet this)=       java/lang/Object *
t_dual=                 java/lang/Object:TopPTR *,iid=top (inline_depth=InlineDepthTop)
this_dual=              java/lang/Class (java/io/Serializable,java/lang/constant/Constable,java/lang/reflect/AnnotatedElement,java/lang/invoke/TypeDescriptor,java/lang/reflect/GenericDeclaration,java/lang/reflect/Type,java/lang/invoke/TypeDescriptor$OfField):AnyNull:exact *,iid=top (inline_depth=InlineDepthTop)
mt_dual=                java/lang/Object:TopPTR *,iid=top (inline_depth=InlineDepthTop)
mt_dual meet t_dual=    java/lang/Object:TopPTR *,iid=top (inline_depth=InlineDepthTop)
mt_dual meet this_dual= java/lang/Object:NotNull * (inline_depth=InlineDepthTop)
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/opt/mach5/mesos/work_dir/slaves/741e9afd-8c02-45c3-b2e2-9db1450d0832-S30282/frameworks/1735e8a2-a1db-478c-8104-60c8b0af87dd-0196/executors/7551930c-624f-451e-833b-31dbb4ab5779/runs/d4f9e4ae-9815-43fd-b20e-6d61f93a9c02/workspace/open/src/hotspot/share/opto/type.cpp:967), pid=3272955, tid=3273000
#  fatal error: meet not symmetric
#
# JRE version: Java(TM) SE Runtime Environment (21.0+17) (fastdebug build 21-ea+17-LTS-1334)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (fastdebug 21-ea+17-LTS-1334, mixed mode, sharing, tiered, compressed oops, compressed class ptrs, g1 gc, linux-aarch64)
# Problematic frame:
# V  [libjvm.so+0x15d5588]  Type::check_symmetrical(Type const*, Type const*, VerifyMeet const&) const+0x208

Current CompileTask:
C2:    634  728   !   4       sun.reflect.misc.MethodUtil::invoke (111 bytes)

Stack: [0x0000fffdcc630000,0x0000fffdcc830000],  sp=0x0000fffdcc828f90,  free space=2019k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x15d5588]  Type::check_symmetrical(Type const*, Type const*, VerifyMeet const&) const+0x208  (type.cpp:967)
V  [libjvm.so+0x15d5844]  Type::meet_helper(Type const*, bool) const+0x1e4  (type.cpp:1002)
V  [libjvm.so+0xc5c06c]  GraphKit::subtype_check_receiver(Node*, ciKlass*, Node**)+0x12c  (type.hpp:231)
V  [libjvm.so+0x723abc]  PredictedCallGenerator::generate(JVMState*)+0x348  (callGenerator.cpp:885)
V  [libjvm.so+0xa2f648]  Parse::do_call()+0x2a8  (doCall.cpp:662)
V  [libjvm.so+0x1363aa8]  Parse::do_one_bytecode()+0x4d8  (parse2.cpp:2704)
V  [libjvm.so+0x13536fc]  Parse::do_one_block()+0x53c  (parse1.cpp:1568)
V  [libjvm.so+0x1354650]  Parse::do_all_blocks()+0x150  (parse1.cpp:713)
V  [libjvm.so+0x1358768]  Parse::Parse(JVMState*, ciMethod*, float)+0xa38  (parse1.cpp:617)
V  [libjvm.so+0x720a28]  ParseGenerator::generate(JVMState*)+0x168  (callGenerator.cpp:99)
[...]

Comments
I converted TypePtr::InterfaceSet::_is_loaded from bool to int to track it being uninitialized and added an assert that it's always initialized when accessed via TypePtr::InterfaceSet::is_loaded(). I hit the assert (extremely intermittent) which confirms that there is a race condition among compiler threads using shared types and racing to compute is_loaded. One thread can set _is_loaded_computed before setting _is_loaded while another thread can already access _is_loaded because _is_loaded_computed is set. This is a regression from JDK-8297933 and a duplicate of JDK-8303512 which has the same root cause.
08-05-2023

Theory: There is a race condition between compiler threads when computing the _is_loaded state for interfaces of shared types via TypePtr::InterfaceSet::compute_is_loaded(). One thread might set `_is_loaded_computed` before setting `_is_loaded` while another thread might observe `_is_loaded_computed == 1` and `_is_loaded == 0` when in fact the interfaces are all loaded. I doubt that the `_interfaces.is_loaded()` is even required. Trying to verify.
05-05-2023

My assert also failed once for "java/lang/Object:TopPTR *,iid=top (inline_depth=InlineDepthTop)#" which is weird because that type does not even implement interfaces.
05-05-2023

When investigating JDK-8303512, I added the following assert to TypeOopPtr::is_loaded(): assert(!klass()->is_loaded() || _interfaces.is_loaded(), "FAIL"); This fails (extremely rare) for the following type: java/lang/Class (java/io/Serializable,java/lang/constant/Constable,java/lang/reflect/AnnotatedElement,java/lang/invoke/TypeDescriptor,java/lang/reflect/GenericDeclaration,java/lang/reflect/Type,java/lang/invoke/TypeDescriptor$OfField):AnyNull:exact *,iid=top (inline_depth=InlineDepthTop) Which means that although the klass is loaded, one of its interfaces is not. I think this explains the issue. In fact, when randomly returning false from TypePtr::InterfaceSet::compute_is_loaded(), I can reproduce this issue as well as JDK-8303512 so they might well be related. Another, potentially related, issue is that TypePtr::InterfaceSet::eq does not take _is_loaded_computed / _is_loaded fields into account.
05-05-2023

Another occurrence: [jmh] t = java/lang/Class (java/io/Serializable,java/lang/constant/Constable,java/lang/reflect/AnnotatedElement,java/lang/invoke/TypeDescriptor,java/lang/reflect/GenericDeclaration,java/lang/reflect/Type,java/lang/invoke/TypeDescriptor$OfField):NotNull:exact * [jmh] this= java/lang/Class (java/io/Serializable,java/lang/constant/Constable,java/lang/reflect/AnnotatedElement,java/lang/invoke/TypeDescriptor,java/lang/reflect/GenericDeclaration,java/lang/reflect/Type,java/lang/invoke/TypeDescriptor$OfField):exact * [jmh] mt=(t meet this)= java/lang/Class (java/io/Serializable,java/lang/constant/Constable,java/lang/reflect/AnnotatedElement,java/lang/invoke/TypeDescriptor,java/lang/reflect/GenericDeclaration,java/lang/reflect/Type,java/lang/invoke/TypeDescriptor$OfField):NotNull:exact * [jmh] t_dual= java/lang/Class (java/io/Serializable,java/lang/constant/Constable,java/lang/reflect/AnnotatedElement,java/lang/invoke/TypeDescriptor,java/lang/reflect/GenericDeclaration,java/lang/reflect/Type,java/lang/invoke/TypeDescriptor$OfField):AnyNull:exact *,iid=top (inline_depth=InlineDepthTop) [jmh] this_dual= java/lang/Class (java/io/Serializable,java/lang/constant/Constable,java/lang/reflect/AnnotatedElement,java/lang/invoke/TypeDescriptor,java/lang/reflect/GenericDeclaration,java/lang/reflect/Type,java/lang/invoke/TypeDescriptor$OfField):exact *,iid=top (inline_depth=InlineDepthTop) [jmh] mt_dual= java/lang/Class (java/io/Serializable,java/lang/constant/Constable,java/lang/reflect/AnnotatedElement,java/lang/invoke/TypeDescriptor,java/lang/reflect/GenericDeclaration,java/lang/reflect/Type,java/lang/invoke/TypeDescriptor$OfField):AnyNull:exact *,iid=top (inline_depth=InlineDepthTop) [jmh] mt_dual meet t_dual= java/lang/Class (java/io/Serializable,java/lang/constant/Constable,java/lang/reflect/AnnotatedElement,java/lang/invoke/TypeDescriptor,java/lang/reflect/GenericDeclaration,java/lang/reflect/Type,java/lang/invoke/TypeDescriptor$OfField):AnyNull:exact *,iid=top (inline_depth=InlineDepthTop) [jmh] mt_dual meet this_dual= java/lang/Class (java/io/Serializable,java/lang/constant/Constable,java/lang/reflect/AnnotatedElement,java/lang/invoke/TypeDescriptor,java/lang/reflect/GenericDeclaration,java/lang/reflect/Type,java/lang/invoke/TypeDescriptor$OfField):NotNull:exact * (inline_depth=InlineDepthTop) Current CompileTask: C2: 1002 706 4 java.lang.String::encode (48 bytes) Stack: [0x0000fffbfafc0000,0x0000fffbfb1c0000], sp=0x0000fffbfb1bb460, free space=2029k Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code) V [libjvm.so+0x15da388] Type::check_symmetrical(Type const*, Type const*, VerifyMeet const&) const+0x208 (type.cpp:967) V [libjvm.so+0x15da644] Type::meet_helper(Type const*, bool) const+0x1e4 (type.cpp:1002) V [libjvm.so+0x136f9e4] Parse::do_field_access(bool, bool)+0x760 (type.hpp:231) V [libjvm.so+0x1367580] Parse::do_one_bytecode()+0x640 (parse.hpp:538) V [libjvm.so+0x1357074] Parse::do_one_block()+0x540 (parse1.cpp:1577) V [libjvm.so+0x1357fc0] Parse::do_all_blocks()+0x150 (parse1.cpp:713) V [libjvm.so+0x135c0d8] Parse::Parse(JVMState*, ciMethod*, float)+0xa38 (parse1.cpp:617) [...] There is a replay file but it does not reproduce the issue (same build, same machine).
02-05-2023

Updated ILW = Verification failure during C2 compilation, only seen once, no known workaround but disable compilation of affected method = HLM = P3
17-04-2023

We assert because: java/lang/Object:TopPTR *,iid=top (inline_depth=InlineDepthTop) MEET java/lang/Class (java/io/Serializable,java/lang/constant/Constable,java/lang/reflect/AnnotatedElement,java/lang/invoke/TypeDescriptor,java/lang/reflect/GenericDeclaration,java/lang/reflect/Type,java/lang/invoke/TypeDescriptor$OfField):AnyNull:exact *,iid=top (inline_depth=InlineDepthTop) Gives: java/lang/Object:NotNull * (inline_depth=InlineDepthTop) But it should be: java/lang/Class (java/io/Serializable,java/lang/constant/Constable,java/lang/reflect/AnnotatedElement,java/lang/invoke/TypeDescriptor,java/lang/reflect/GenericDeclaration,java/lang/reflect/Type,java/lang/invoke/TypeDescriptor$OfField):AnyNull:exact *,iid=top (inline_depth=InlineDepthTop) Not sure how that happened (maybe it's related to JDK-6312651 which introduced some significant changes to the type system).
17-04-2023

ILW = Fatal error in parsing of C2 code, only seen once, no known workaround = HLH = P2
31-03-2023