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

ThreadMXBean.getThread{Cpu,User}Time fails with -XX:-VMContinuations

XMLWordPrintable

        The conformance tests validating the GetThreadCpuTime and GetThreadUserTime fails when run with
        Specific VM options: "-XX:+UnlockExperimentalVMOptions -XX:-VMContinuations"

        As per the spec - "If the thread of the specified ID is a virtual thread thease methods supposed to return -1."
        The tests works fine in general, but fails when run with "-XX:+UnlockExperimentalVMOptions -XX:-VMContinuations"

        Attached the code snipped to demonstrate the issue.

        Validation logs:
        ===
        Regular Run:

        /scratch/jdk-cache/19/31/jdk-19/bin/javac -source 19 --enable-preview TestThreadUserAndCpuTime.java
        Note: TestThreadUserAndCpuTime.java uses preview features of Java SE 19.
        Note: Recompile with -Xlint:preview for details.
        /scratch/jdk-cache/19/31/jdk-19/bin/java --enable-preview TestThreadUserAndCpuTime
         OK - Expected
         OK - Expected

        With operating mode (-XX:+UnlockExperimentalVMOptions -XX:-VMContinuations)
        =======
        /scratch/jdk-cache/19/31/jdk-19/bin/java --enable-preview -XX:+UnlockExperimentalVMOptions -XX:-VMContinuations TestThreadUserAndCpuTime
         Not OK for getThreadUserTime() - expected -1 but returned 0
         Not OK for getThreadCpuTime() : expected -1 but returned 344055
        ====

              alanb Alan Bateman
              kganapureddy Krushnareddy Ganapureddy
              Votes:
              0 Vote for this issue
              Watchers:
              12 Start watching this issue

                Created:
                Updated:
                Resolved: