Reliably reproduces in jdk/jdk:
$ CONF=linux-x86_64-server-fastdebug make images run-test TEST=com/sun/jdi/InvokeTest.java TEST_VM_OPTS="-Xcheck:jni"
----------System.out:(35/1974)----------
vmOpts: '-Xmx512m -XX:MaxRAMPercentage=3 -Xcheck:jni -ea -esa'
javaOpts: ''
JVM version:14-internal
JDI version: 14.0
JVM description: Java Debug Interface (Reference Implementation) version 14.0
Java Debug Wire Protocol (Reference Implementation) version 14.0
JVM Debug Interface version 14.0
JVM version 14-internal (OpenJDK 64-Bit Server VM, mixed mode, sharing)
WARNING in native method: JNI call made without checking exceptions when required to from CallStaticObjectMethod
WARNING: JNI local refs: 415, exceeds capacity: 35
Howdy!
WARNING: JNI local refs: 507, exceeds capacity: 33
# To suppress the following error report, specify this argument
# after -XX: or in .hotspotrc: SuppressErrorAt=/instanceKlass.hpp:1019
#
# A fatal error has been detected by the Java Runtime Environment:
#
# Internal Error (/home/shade/trunks/jdk-jdk/src/hotspot/share/oops/instanceKlass.hpp:1019), pid=20573, tid=20578
# assert(k->is_instance_klass()) failed: cast to InstanceKlass
#
# JRE version: OpenJDK Runtime Environment (14.0) (fastdebug build 14-internal+0-adhoc.shade.jdk-jdk)
# Java VM: OpenJDK 64-Bit Server VM (fastdebug 14-internal+0-adhoc.shade.jdk-jdk, mixed mode, sharing, tiered, compressed oops, g1 gc, linux-amd64)
# Problematic frame:
# V [libjvm.so+0xf2a46a] jniCheck::validate_call(JavaThread*, _jclass*, _jmethodID*, _jobject*) [clone .constprop.77]+0x18a
#
# 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 /home/shade/trunks/jdk-jdk/build/linux-x86_64-server-fastdebug/test-support/jtreg_test_jdk_tier1/scratch/3/core.20573)
#
# An error report file with more information is saved as:
# /home/shade/trunks/jdk-jdk/build/linux-x86_64-server-fastdebug/test-support/jtreg_test_jdk_tier1/scratch/3/hs_err_pid20573.log
#
# If you would like to submit a bug report, please visit:
# http://bugreport.java.com/bugreport/crash.jsp
#
--------------- T H R E A D ---------------
Current thread (0x00007ff914025000): JavaThread "main" [_thread_in_vm, id=32010, stack(0x00007ff91e2a3000,0x00007ff91e3a4000)]
Stack: [0x00007ff91e2a3000,0x00007ff91e3a4000], sp=0x00007ff91e3a2390, free space=1020k
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
V [libjvm.so+0xf2a46a] jniCheck::validate_call(JavaThread*, _jclass*, _jmethodID*, _jobject*) [clone .constprop.77]+0x18a
V [libjvm.so+0xf2ab41] checked_jni_CallObjectMethodA+0xd1
C [libjdwp.so+0x1cb96] invoker_doInvoke+0xe66
C [libjdwp.so+0x14c7d] reportEvents.part.2+0xad
C [libjdwp.so+0x1505a] event_callback+0x1da
C [libjdwp.so+0x17e58] cbBreakpoint+0xc8
V [libjvm.so+0x111dc78] JvmtiExport::post_raw_breakpoint(JavaThread*, Method*, unsigned char*)+0x2a8
V [libjvm.so+0xdee187] InterpreterRuntime::_breakpoint(JavaThread*, Method*, unsigned char*)+0xc7
j InvokeTarg.sayHi()V+0
j InvokeTarg.main([Ljava/lang/String;)V+15
v ~StubRoutines::call_stub
V [libjvm.so+0xe0495c] JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, Thread*)+0x71c
V [libjvm.so+0xed1499] jni_invoke_static(JNIEnv_*, JavaValue*, _jobject*, JNICallType, _jmethodID*, JNI_ArgumentPusher*, Thread*) [clone .isra.153] [clone .constprop.242]+0x2a9
V [libjvm.so+0xeeea57] jni_CallStaticVoidMethodV+0x197
V [libjvm.so+0xf3e865] checked_jni_CallStaticVoidMethod+0x185
C [libjli.so+0x4d33] JavaMain+0xbd3
C [libjli.so+0x8239] ThreadJavaMain+0x9