Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-19711

Resolve virtual thread pinning issues in client side Angus code

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Unresolved
    • Icon: Major Major
    • None
    • None
    • Mail
    • ---
    • ---

      When I was testing executing WildFly workloads on a virtual thread, turning on JVM thread pinning logging (see WFLY-19536) revealed pinning happening in client-side Eclipse Angus code (e.g. sending emails). This issue is to trace working with the Angus community to resolve these issues and get the fixed code into WildFly.

      See occurrences of 'onPinned' in https://ci.wildfly.org/repository/download/WF_MainNightlyJobs_StandardLinuxJdk21/446569:id/testsuite/integration/basic/target/wildfly/standalone/log/server.log. Lines in the stack trace annotated with "<== monitor" show where a monitor lock was taken that results in pinning when blocking code executes.

      An example:

      2024-07-18 05:23:38,520 INFO  [stdout] (ForkJoinPool-1-worker-16) Thread[#18608,ForkJoinPool-1-worker-16,5,CarrierThreads]
      2024-07-18 05:23:38,520 INFO  [stdout] (ForkJoinPool-1-worker-16)     java.base/java.lang.VirtualThread$VThreadContinuation.onPinned(VirtualThread.java:185)
      2024-07-18 05:23:38,521 INFO  [stdout] (ForkJoinPool-1-worker-16)     java.base/jdk.internal.vm.Continuation.onPinned0(Continuation.java:393)
      2024-07-18 05:23:38,521 INFO  [stdout] (ForkJoinPool-1-worker-16)     java.base/java.lang.VirtualThread.park(VirtualThread.java:592)
      2024-07-18 05:23:38,521 INFO  [stdout] (ForkJoinPool-1-worker-16)     java.base/java.lang.System$2.parkVirtualThread(System.java:2639)
      2024-07-18 05:23:38,521 INFO  [stdout] (ForkJoinPool-1-worker-16)     java.base/jdk.internal.misc.VirtualThreads.park(VirtualThreads.java:54)
      2024-07-18 05:23:38,521 INFO  [stdout] (ForkJoinPool-1-worker-16)     java.base/java.util.concurrent.locks.LockSupport.park(LockSupport.java:369)
      2024-07-18 05:23:38,521 INFO  [stdout] (ForkJoinPool-1-worker-16)     java.base/sun.nio.ch.Poller$Request.awaitFinish(Poller.java:215)
      2024-07-18 05:23:38,521 INFO  [stdout] (ForkJoinPool-1-worker-16)     java.base/sun.nio.ch.Poller.pollIndirect(Poller.java:143)
      2024-07-18 05:23:38,521 INFO  [stdout] (ForkJoinPool-1-worker-16)     java.base/sun.nio.ch.Poller.poll(Poller.java:102)
      2024-07-18 05:23:38,521 INFO  [stdout] (ForkJoinPool-1-worker-16)     java.base/sun.nio.ch.Poller.poll(Poller.java:89)
      2024-07-18 05:23:38,521 INFO  [stdout] (ForkJoinPool-1-worker-16)     java.base/sun.nio.ch.NioSocketImpl.park(NioSocketImpl.java:175)
      2024-07-18 05:23:38,521 INFO  [stdout] (ForkJoinPool-1-worker-16)     java.base/sun.nio.ch.NioSocketImpl.park(NioSocketImpl.java:201)
      2024-07-18 05:23:38,521 INFO  [stdout] (ForkJoinPool-1-worker-16)     java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:597)
      2024-07-18 05:23:38,521 INFO  [stdout] (ForkJoinPool-1-worker-16)     java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327)
      2024-07-18 05:23:38,521 INFO  [stdout] (ForkJoinPool-1-worker-16)     java.base/java.net.Socket.connect(Socket.java:751)
      2024-07-18 05:23:38,521 INFO  [stdout] (ForkJoinPool-1-worker-16)     java.base/java.net.Socket.connect(Socket.java:686)
      2024-07-18 05:23:38,521 INFO  [stdout] (ForkJoinPool-1-worker-16)     org.eclipse.angus.mail@2.0.3//org.eclipse.angus.mail.util.SocketFetcher.createSocket(SocketFetcher.java:368)
      2024-07-18 05:23:38,521 INFO  [stdout] (ForkJoinPool-1-worker-16)     org.eclipse.angus.mail@2.0.3//org.eclipse.angus.mail.util.SocketFetcher.getSocket(SocketFetcher.java:243)
      2024-07-18 05:23:38,521 INFO  [stdout] (ForkJoinPool-1-worker-16)     org.eclipse.angus.mail@2.0.3//org.eclipse.angus.mail.pop3.Protocol.<init>(Protocol.java:121)
      2024-07-18 05:23:38,521 INFO  [stdout] (ForkJoinPool-1-worker-16)     org.eclipse.angus.mail@2.0.3//org.eclipse.angus.mail.pop3.POP3Store.getPort(POP3Store.java:250) <== monitors:1
      2024-07-18 05:23:38,521 INFO  [stdout] (ForkJoinPool-1-worker-16)     org.eclipse.angus.mail@2.0.3//org.eclipse.angus.mail.pop3.POP3Store.protocolConnect(POP3Store.java:192) <== monitors:1
      2024-07-18 05:23:38,521 INFO  [stdout] (ForkJoinPool-1-worker-16)     jakarta.mail.api@2.1.3//jakarta.mail.Service.connect(Service.java:345) <== monitors:1
      2024-07-18 05:23:38,521 INFO  [stdout] (ForkJoinPool-1-worker-16)     jakarta.mail.api@2.1.3//jakarta.mail.Service.connect(Service.java:225)
      2024-07-18 05:23:38,521 INFO  [stdout] (ForkJoinPool-1-worker-16)     jakarta.mail.api@2.1.3//jakarta.mail.Service.connect(Service.java:246)
      2024-07-18 05:23:38,521 INFO  [stdout] (ForkJoinPool-1-worker-16)     deployment.d1e69a0b-f63d-4d5f-aa9a-5f42cf984c53.war//org.jboss.as.test.integration.mail.basic.MailTesterServlet.tryToReadEmails(MailTesterServlet.java:73)
      

      Note that in the above stack, jakarta.mail.Service.connect also pins the thread. I'll file a separate issue for that.

      To reproduce build https://github.com/bstansberry/wildfly/tree/pinning_check on SE 21.

            yborgess1@redhat.com Yeray Borges Santana
            bstansbe@redhat.com Brian Stansberry
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: