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

Running with -Djdk.tracePinnedThreads set can hang

    XMLWordPrintable

Details

    • b05

    Backports

      Description

        -Djdk.tracePinnedThreads dates from early development in the loom repo to identify pinned threads. It has several issues and will eventually be removed (in favour of JFR of events). Several hangs have been reported when running with this system property set. The "hangs" stem from the onPinned method executing while the virtual thread is in a transition state (typically parking). If the virtual parks while printing the stack trace then it works like a nested park where the thread state is never restored. Contention on the System.out can also lead to deadlock when there are platform and pinned virtual threads printing to System.out around the same time.

        This JBS issue tracks some short term changes to the implementation to avoid the hangs that have been reported when running with this system property set. Specifically, it only attempts to print the stack trace when System.out's lock can be acquired without blocking, and restoring the thread state after printing.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                  Created:
                  Updated:
                  Resolved: