Overloaded constructor MountUnmountDisabler(jthread thread) is missed

XMLWordPrintable

    • master

      The JVM TI code has a common pattern to instantiate the MountUnmountDisabler:
         MountUnmountDisabler disabler(thread);
      where the 'thread' argument has the type: jthread.
      One example:
      JvmtiEnv::GetThreadState(jthread thread, jint* thread_state_ptr) {
        JavaThread* current_thread = JavaThread::current();
        MountUnmountDisabler disabler(thread);

      Now, the MountUnmountDisabler class has two constructors:
        MountUnmountDisabler(oop thread_oop); // disable transitions for one
        MountUnmountDisabler(bool exclusive); // disable transitions for all

      The common JVM TI pattern above is currently resolved to the second constructor where the jthread argument is converted to 'true'. It makes the instantiated MountUnmountDisabler to disable mount/unmount transitions for all virtual thread instead of the specific one. This problem was identified with a minor tracing.

      So, all the above shows that the following overloaded constructor is currently missed:
        MountUnmountDisabler(jthread thread);

      It is a regression which was introduced in jdk 26 with the fix of:
      JDK-8364343: Virtual Thread transition management needs to be independent of JVM TI

      The fix replaced the constructor:
        MountUnmountDisabler(jthread thread);

      with:
        MountUnmountDisabler(oop thread_oop);

            Assignee:
            Serguei Spitsyn
            Reporter:
            Serguei Spitsyn
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: