Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8313656

assert(!JvmtiExport::can_support_virtual_threads()) with -XX:-DoJVMTIVirtualThreadTransitions

XMLWordPrintable

    • b14

        This is a follow up to the discussion at https://github.com/async-profiler/async-profiler/issues/779

        When DoJVMTIVirtualThreadTransitions option is off as recommended for profiling, slowdebug build crashes with the following error:

        #
        # Internal Error (/home/andrei/jdk/src/hotspot/share/prims/jvm.cpp:3953), pid=737, tid=765
        # assert(!JvmtiExport::can_support_virtual_threads()) failed: sanity check
        #
        # JRE version: OpenJDK Runtime Environment (22.0) (slowdebug build 22-internal-adhoc.andrei.jdk)
        # Java VM: OpenJDK 64-Bit Server VM (slowdebug 22-internal-adhoc.andrei.jdk, mixed mode, tiered, compressed oops, compressed class ptrs, g1 gc, linux-amd64)
        # Problematic frame:
        # V [libjvm.so+0xf36710] JVM_VirtualThreadMount+0xa9

        === Command line ===
        java -XX:+UnlockExperimentalVMOptions -XX:-DoJVMTIVirtualThreadTransitions -ag
        entpath:/path/to/emptyagent.so HelloVirtualThread

        === HelloVirtualThread.java ===
        public class HelloVirtualThread {
            public static void main(String[] args) throws Exception {
                Thread.startVirtualThread(() -> System.out.println("hello")).join();
            }
        }

        === emptyagent.c ===
        #include <jvmti.h>

        int Agent_OnLoad(JavaVM* vm, char* options, void* reserved) {
            jvmtiEnv* jvmti;
            (*vm)->GetEnv(vm, (void**)&jvmti, JVMTI_VERSION_21);

            jvmtiCapabilities capabilities = {0};
            (*jvmti)->AddCapabilities(jvmti, &capabilities);

            return 0;
        }
        ===

        Note that the agent calls AddCapabilities() with no capabilities set, but according to the triggered assertion JvmtiExport::can_support_virtual_threads() is true.

              amenkov Alex Menkov
              apangin Andrei Pangin
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: