JDK-8226798 : JVM crash in klassItable::initialize_itable_for_interface(int, InstanceKlass*, bool, Thread*)
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 8,11,12.0.1,13,14
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2019-06-25
  • Updated: 2022-06-27
  • Resolved: 2019-07-11
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 JDK 8 Other
11.0.5Fixed 13.0.4Fixed 14 b06Fixed 8u241Fixed openjdk8u232Fixed
Description
ADDITIONAL SYSTEM INFORMATION :
I tested JDK 12 and JDK 8 on Windows and JDK 11 on Linux. They all crash in the same way.

A DESCRIPTION OF THE PROBLEM :
Running code that invokes a default method that should fail with IllegalAccessError instead crashes the VM. See code sample.

# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007fe034e40945, pid=497, tid=498
#
# JRE version: Java(TM) SE Runtime Environment (14.0+2) (build 14-ea+2-29)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (14-ea+2-29, mixed mode, sharing, tiered, compressed oops, g1 gc, linux-amd64)
# Problematic frame:
# V  [libjvm.so+0xa1b945]  klassItable::initialize_itable_for_interface(int, InstanceKlass*, bool, Thread*)+0x35
#
# Core dump will be written. Default location: Core dumps may be processed with "/usr/libexec/abrt-hook-ccpp %s %c %p %u %g %t e" (or dumping to /scratch/fairoz/JI/hotspot/9061398/core.497)
#
# 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: Main

Host: Intel(R) Xeon(R) CPU E5-2699 v3 @ 2.30GHz, 4 cores, 14G, Oracle Linux Server release 6.7
Time: Tue Jun 25 20:30:33 2019 PDT elapsed time: 0 seconds (0d 0h 0m 0s)

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

Current thread (0x00007fe030018800):  JavaThread "main" [_thread_in_vm, id=498, stack(0x00007fe034324000,0x00007fe034425000)]

Stack: [0x00007fe034324000,0x00007fe034425000],  sp=0x00007fe034423420,  free space=1021k
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0xa1b945]  klassItable::initialize_itable_for_interface(int, InstanceKlass*, bool, Thread*)+0x35
V  [libjvm.so+0xa1bfa4]  klassItable::initialize_itable(bool, Thread*)+0xf4
V  [libjvm.so+0x814d03]  InstanceKlass::link_class_impl(Thread*)+0x3c3
V  [libjvm.so+0x815b5b]  InstanceKlass::initialize_impl(Thread*)+0x27b
V  [libjvm.so+0x82d108]  InterpreterRuntime::_new(JavaThread*, ConstantPool*, int)+0x188
j  Main.main([Ljava/lang/String;)V+0
v  ~StubRoutines::call_stub
V  [libjvm.so+0x836909]  JavaCalls::call_helper(JavaValue*, methodHandle const&, JavaCallArguments*, Thread*)+0x319
V  [libjvm.so+0x8adce4]  jni_invoke_static(JNIEnv_*, JavaValue*, _jobject*, JNICallType, _jmethodID*, JNI_ArgumentPusher*, Thread*) [clone .isra.83] [clone .constprop.300]+0x1e4
V  [libjvm.so+0x8b0817]  jni_CallStaticVoidMethod+0x157
C  [libjli.so+0x45f7]  JavaMain+0xcd7
C  [libjli.so+0x8669]  ThreadJavaMain+0x9


---------- BEGIN SOURCE ----------
Main.java:
public class Main {
    interface Intf {
        default void a() {
        }
        default void unusedButNeededToReproduceIssue() {
        }
    }
    static class B extends pkg.A implements Intf {
    }
    static class C extends B {
        public void a() {
        }
    }
    public static void main(String[] args) {
        ((B)new C()).a();
    }
}


pkg/A.java:
package pkg;

public class A {
    void a() {
    }
}

---------- END SOURCE ----------

FREQUENCY : always



Comments
Fix request (13u): The change applies cleanly, tested with tier1.
15-05-2020

8u Fix Request: I would like to backport this patch to 8u, as it fixes a fatal crash that affects 8u. The original patch applies cleanly and passes attached test.
23-08-2019

11u Fix Request: I would like to backport this patch to 11u. It fixes a fatal crash and on Oracle's 11u backport. The original patch applies cleanly.
05-08-2019

URL: https://hg.openjdk.java.net/jdk/jdk/rev/419420eb5230 User: hseigel Date: 2019-07-11 13:26:26 +0000
11-07-2019

Attached hs_error file generated on 14 ea b02
26-06-2019

Issue is reproducible in all the versions 8u212 - Fail 11.0.3 - Fail 12.0.1 - Fail 13 ea b24 - Fail 14 ea b02 - Fail
26-06-2019