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

[21u] juc cannot be woken up when using virtual thread

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3 P3
    • None
    • 21
    • core-libs
    • None
    • 30 CPU cores.

      When using virtual thread, the juc unpark event may not be executed and the whole application will wait forever.

      I have constructed a simple testcase to emulate the situation.
      I put the two files in the test/jdk/java/lang/Thread/virtual/ and run jtreg test it. The fail rate is 13/30.

      I find that there may be a problem in ForkJoinPool.java.
      The `signalWork` may choose do nothing when (c >>> RC_SHIFT) >= pc. (In the testcase, 29 threads are pinned and one is free for doing some work.)
      And the one active thread which is in the first lines of the function `awaitWork` (before change the ctl) will not be signaled and choose to park.

        1. jcmd.log
          100 kB
        2. JucSyncNativeMethod.java
          4 kB
        3. JucSyncNativeMethod.jtr
          52 kB
        4. JucSyncNativeMethod-1.jtr
          48 kB
        5. JucSyncNativeMethod-2.jtr
          52 kB
        6. libJucSyncNativeMethod.c
          1 kB

            vklang Viktor Klang
            jwtang Jiawei Tang
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: