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

Thread::getStackTrace can fail with InternalError if virtual thread is timed-parked when pinned

    XMLWordPrintable

Details

    • 22
    • b05

    Backports

      Description

        VirtualThread::tryGetStackTrace needs to handle TIMED_PINNED. If Thread::getStackTrace is called on a virtual Thread goes quickly from unmounted to a timed-park-while-pinned when getStackTrace will fail with:

        java.lang.InternalError
        at java.base/java.lang.VirtualThread.tryGetStackTrace(VirtualThread.java:995)
        at java.base/java.lang.VirtualThread.asyncGetStackTrace(VirtualThread.java:965)
        at java.base/java.lang.Thread.getStackTrace(Thread.java:2376)
        at GetStackTraceALotWhenPinned.main(GetStackTraceALotWhenPinned.java:72)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
        at java.base/java.lang.reflect.Method.invoke(Method.java:580)
        at com.sun.javatest.regtest.agent.MainActionHelper$AgentVMRunnable.run(MainActionHelper.java:333)
        at java.base/java.lang.Thread.run(Thread.java:1570)

        This is a regression since JDK-8312498, needs a stress test to provoke this scenario.

        Attachments

          Issue Links

            Activity

              People

                alanb Alan Bateman
                alanb Alan Bateman
                Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: