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

Make com.sun.jndi.dns.DnsClient virtual threads friendly

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 20
    • None
    • core-libs
    • None
    • b24
    • generic
    • generic

    Description

      Running simple JNDI application with DNS context lookup done from virtual thread and the -Djdk.tracePinnedThreads=full system property set yields the following trace output:
      Thread[#21,ForkJoinPool-1-worker-1,5,CarrierThreads]
          java.base/java.lang.VirtualThread$VThreadContinuation.onPinned(VirtualThread.java:180)
          java.base/jdk.internal.vm.Continuation.onPinned0(Continuation.java:398)
          java.base/jdk.internal.vm.Continuation.yield0(Continuation.java:390)
          java.base/jdk.internal.vm.Continuation.yield(Continuation.java:357)
          java.base/java.lang.VirtualThread.yieldContinuation(VirtualThread.java:370)
          java.base/java.lang.VirtualThread.parkNanos(VirtualThread.java:532)
          java.base/java.lang.System$2.parkVirtualThread(System.java:2605)
          java.base/jdk.internal.misc.VirtualThreads.park(VirtualThreads.java:67)
          java.base/java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:408)
          java.base/sun.nio.ch.Poller.poll2(Poller.java:137)
          java.base/sun.nio.ch.Poller.poll(Poller.java:102)
          java.base/sun.nio.ch.Poller.poll(Poller.java:87)
          java.base/sun.nio.ch.DatagramChannelImpl.park(DatagramChannelImpl.java:486)
          java.base/sun.nio.ch.DatagramChannelImpl.trustedBlockingReceive(DatagramChannelImpl.java:734)
          java.base/sun.nio.ch.DatagramChannelImpl.blockingReceive(DatagramChannelImpl.java:661)
          java.base/sun.nio.ch.DatagramSocketAdaptor.receive(DatagramSocketAdaptor.java:241) <== monitors:1
          java.base/java.net.DatagramSocket.receive(DatagramSocket.java:714)
          jdk.naming.dns/com.sun.jndi.dns.DnsClient.doUdpQuery(DnsClient.java:430) <== monitors:1
          jdk.naming.dns/com.sun.jndi.dns.DnsClient.query(DnsClient.java:216)
          jdk.naming.dns/com.sun.jndi.dns.Resolver.query(Resolver.java:81)
          jdk.naming.dns/com.sun.jndi.dns.DnsContext.c_lookup(DnsContext.java:290)
          java.naming/com.sun.jndi.toolkit.ctx.ComponentContext.p_lookup(ComponentContext.java:542)
          java.naming/com.sun.jndi.toolkit.ctx.PartialCompositeContext.lookup(PartialCompositeContext.java:177)
          java.naming/com.sun.jndi.toolkit.ctx.PartialCompositeContext.lookup(PartialCompositeContext.java:166)
          java.naming/javax.naming.InitialContext.lookup(InitialContext.java:409)
          DnsWithVTs.doLookup(DnsWithVTs.java:26)
          DnsWithVTs.lambda$doDnsCtxLookup$0(DnsWithVTs.java:15)
          java.base/java.lang.VirtualThread.run(VirtualThread.java:287)
          java.base/java.lang.VirtualThread$VThreadContinuation.lambda$new$0(VirtualThread.java:174)
          java.base/jdk.internal.vm.Continuation.enter0(Continuation.java:327)
          java.base/jdk.internal.vm.Continuation.enter(Continuation.java:320)

      com.sun.jndi.dns.DnsClient class needs to be updated to use DatagramChannel and j.u.c.l locks to be virtual thread friendly by avoiding pinning carrier threads.

      Attachments

        Issue Links

          Activity

            People

              aefimov Aleksej Efimov
              aefimov Aleksej Efimov
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: