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

Fix virtual thread pinning in AbstractJMSContext

XMLWordPrintable

      Doing blocking work inside the mapping function passed to ConcurrentHashMap.computeIfAbsent result in virtual thread pinning:

      2024-07-18 21:07:36,968 INFO  [stdout] (ForkJoinPool-1-worker-5) Thread[#562,ForkJoinPool-1-worker-5,5,CarrierThreads]
      2024-07-18 21:07:36,968 INFO  [stdout] (ForkJoinPool-1-worker-5)     java.base/java.lang.VirtualThread$VThreadContinuation.onPinned(VirtualThread.java:183)
      2024-07-18 21:07:36,968 INFO  [stdout] (ForkJoinPool-1-worker-5)     java.base/jdk.internal.vm.Continuation.onPinned0(Continuation.java:393)
      2024-07-18 21:07:36,969 INFO  [stdout] (ForkJoinPool-1-worker-5)     java.base/java.lang.VirtualThread.parkNanos(VirtualThread.java:621)
      2024-07-18 21:07:36,969 INFO  [stdout] (ForkJoinPool-1-worker-5)     java.base/java.lang.System$2.parkVirtualThread(System.java:2652)
      2024-07-18 21:07:36,969 INFO  [stdout] (ForkJoinPool-1-worker-5)     java.base/jdk.internal.misc.VirtualThreads.park(VirtualThreads.java:67)
      2024-07-18 21:07:36,969 INFO  [stdout] (ForkJoinPool-1-worker-5)     java.base/java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:267)
      2024-07-18 21:07:36,969 INFO  [stdout] (ForkJoinPool-1-worker-5)     java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1847)
      2024-07-18 21:07:36,969 INFO  [stdout] (ForkJoinPool-1-worker-5)     org.apache.activemq.artemis.client@2.35.0//org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:524) <== monitors:1
      2024-07-18 21:07:36,969 INFO  [stdout] (ForkJoinPool-1-worker-5)     org.apache.activemq.artemis.client@2.35.0//org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:452)
      2024-07-18 21:07:36,969 INFO  [stdout] (ForkJoinPool-1-worker-5)     org.apache.activemq.artemis.client@2.35.0//org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQClientProtocolManager.createSessionContext(ActiveMQClientProtocolManager.java:308)
      2024-07-18 21:07:36,969 INFO  [stdout] (ForkJoinPool-1-worker-5)     org.apache.activemq.artemis.client@2.35.0//org.apache.activemq.artemis.core.protocol.core.impl.ActiveMQClientProtocolManager.createSessionContext(ActiveMQClientProtocolManager.java:256)
      2024-07-18 21:07:36,969 INFO  [stdout] (ForkJoinPool-1-worker-5)     org.apache.activemq.artemis.client@2.35.0//org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSessionChannel(ClientSessionFactoryImpl.java:1533) <== monitors:1
      2024-07-18 21:07:36,969 INFO  [stdout] (ForkJoinPool-1-worker-5)     org.apache.activemq.artemis.client@2.35.0//org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSessionInternal(ClientSessionFactoryImpl.java:847)
      2024-07-18 21:07:36,969 INFO  [stdout] (ForkJoinPool-1-worker-5)     org.apache.activemq.artemis.client@2.35.0//org.apache.activemq.artemis.core.client.impl.ClientSessionFactoryImpl.createSession(ClientSessionFactoryImpl.java:349)
      2024-07-18 21:07:36,969 INFO  [stdout] (ForkJoinPool-1-worker-5)     org.apache.activemq.artemis.client@2.35.0//org.apache.activemq.artemis.jms.client.ActiveMQConnection.authorize(ActiveMQConnection.java:650)
      2024-07-18 21:07:36,969 INFO  [stdout] (ForkJoinPool-1-worker-5)     org.apache.activemq.artemis.client@2.35.0//org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnectionInternal(ActiveMQConnectionFactory.java:949) <== monitors:1
      2024-07-18 21:07:36,969 INFO  [stdout] (ForkJoinPool-1-worker-5)     org.apache.activemq.artemis.client@2.35.0//org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createXAConnection(ActiveMQConnectionFactory.java:387)
      2024-07-18 21:07:36,969 INFO  [stdout] (ForkJoinPool-1-worker-5)     org.apache.activemq.artemis.client@2.35.0//org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createXAConnection(ActiveMQConnectionFactory.java:382)
      2024-07-18 21:07:36,969 INFO  [stdout] (ForkJoinPool-1-worker-5)     org.apache.activemq.artemis.ra@2.35.0//org.apache.activemq.artemis.ra.ActiveMQRAManagedConnection.setup(ActiveMQRAManagedConnection.java:715)
      2024-07-18 21:07:36,969 INFO  [stdout] (ForkJoinPool-1-worker-5)     org.apache.activemq.artemis.ra@2.35.0//org.apache.activemq.artemis.ra.ActiveMQRAManagedConnection.<init>(ActiveMQRAManagedConnection.java:161)
      2024-07-18 21:07:36,969 INFO  [stdout] (ForkJoinPool-1-worker-5)     org.apache.activemq.artemis.ra@2.35.0//org.apache.activemq.artemis.ra.ActiveMQRAManagedConnectionFactory.createManagedConnection(ActiveMQRAManagedConnectionFactory.java:144)
      2024-07-18 21:07:36,969 INFO  [stdout] (ForkJoinPool-1-worker-5)     org.jboss.ironjacamar.impl@3.0.9.Final//org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreConcurrentLinkedDequeManagedConnectionPool.createConnectionEventListener(SemaphoreConcurrentLinkedDequeManagedConnectionPool.java:1328)
      2024-07-18 21:07:36,969 INFO  [stdout] (ForkJoinPool-1-worker-5)     org.jboss.ironjacamar.impl@3.0.9.Final//org.jboss.jca.core.connectionmanager.pool.mcp.SemaphoreConcurrentLinkedDequeManagedConnectionPool.getConnection(SemaphoreConcurrentLinkedDequeManagedConnectionPool.java:505)
      2024-07-18 21:07:36,969 INFO  [stdout] (ForkJoinPool-1-worker-5)     org.jboss.ironjacamar.impl@3.0.9.Final//org.jboss.jca.core.connectionmanager.pool.AbstractPool.getSimpleConnection(AbstractPool.java:688)
      2024-07-18 21:07:36,969 INFO  [stdout] (ForkJoinPool-1-worker-5)     org.jboss.ironjacamar.impl@3.0.9.Final//org.jboss.jca.core.connectionmanager.pool.AbstractPool.getConnection(AbstractPool.java:653)
      2024-07-18 21:07:36,969 INFO  [stdout] (ForkJoinPool-1-worker-5)     org.jboss.ironjacamar.impl@3.0.9.Final//org.jboss.jca.core.connectionmanager.AbstractConnectionManager.getManagedConnection(AbstractConnectionManager.java:624)
      2024-07-18 21:07:36,969 INFO  [stdout] (ForkJoinPool-1-worker-5)     org.jboss.ironjacamar.impl@3.0.9.Final//org.jboss.jca.core.connectionmanager.tx.TxConnectionManagerImpl.getManagedConnection(TxConnectionManagerImpl.java:440)
      2024-07-18 21:07:36,969 INFO  [stdout] (ForkJoinPool-1-worker-5)     org.jboss.ironjacamar.impl@3.0.9.Final//org.jboss.jca.core.connectionmanager.AbstractConnectionManager.allocateConnection(AbstractConnectionManager.java:789)
      2024-07-18 21:07:36,969 INFO  [stdout] (ForkJoinPool-1-worker-5)     org.apache.activemq.artemis.ra@2.35.0//org.apache.activemq.artemis.ra.ActiveMQRASessionFactoryImpl.allocateConnection(ActiveMQRASessionFactoryImpl.java:792) <== monitors:1
      2024-07-18 21:07:36,969 INFO  [stdout] (ForkJoinPool-1-worker-5)     org.apache.activemq.artemis.ra@2.35.0//org.apache.activemq.artemis.ra.ActiveMQRASessionFactoryImpl.createSession(ActiveMQRASessionFactoryImpl.java:482)
      2024-07-18 21:07:36,969 INFO  [stdout] (ForkJoinPool-1-worker-5)     org.apache.activemq.artemis.ra@2.35.0//org.apache.activemq.artemis.ra.ActiveMQRASessionFactoryImpl.createSession(ActiveMQRASessionFactoryImpl.java:673)
      2024-07-18 21:07:36,969 INFO  [stdout] (ForkJoinPool-1-worker-5)     org.apache.activemq.artemis.ra@2.35.0//org.apache.activemq.artemis.ra.ActiveMQRASessionFactoryImpl.createSession(ActiveMQRASessionFactoryImpl.java:678)
      2024-07-18 21:07:36,969 INFO  [stdout] (ForkJoinPool-1-worker-5)     org.apache.activemq.artemis.ra@2.35.0//org.apache.activemq.artemis.ra.ActiveMQRAConnectionFactoryImpl.validateUser(ActiveMQRAConnectionFactoryImpl.java:422)
      2024-07-18 21:07:36,969 INFO  [stdout] (ForkJoinPool-1-worker-5)     org.apache.activemq.artemis.ra@2.35.0//org.apache.activemq.artemis.ra.ActiveMQRAConnectionFactoryImpl.createContext(ActiveMQRAConnectionFactoryImpl.java:379)
      2024-07-18 21:07:36,969 INFO  [stdout] (ForkJoinPool-1-worker-5)     org.apache.activemq.artemis.ra@2.35.0//org.apache.activemq.artemis.ra.ActiveMQRAConnectionFactoryImpl.createContext(ActiveMQRAConnectionFactoryImpl.java:394)
      2024-07-18 21:07:36,969 INFO  [stdout] (ForkJoinPool-1-worker-5)     org.wildfly.extension.messaging-activemq.injection@34.0.0.Beta1-SNAPSHOT//org.wildfly.extension.messaging.activemq.deployment.injection.AbstractJMSContext.createContext(AbstractJMSContext.java:40)
      2024-07-18 21:07:36,969 INFO  [stdout] (ForkJoinPool-1-worker-5)     org.wildfly.extension.messaging-activemq.injection@34.0.0.Beta1-SNAPSHOT//org.wildfly.extension.messaging.activemq.deployment.injection.AbstractJMSContext.lambda$getContext$0(AbstractJMSContext.java:30)
      2024-07-18 21:07:36,969 INFO  [stdout] (ForkJoinPool-1-worker-5)     java.base/java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1708) <== monitors:1
      2024-07-18 21:07:36,969 INFO  [stdout] (ForkJoinPool-1-worker-5)     org.wildfly.extension.messaging-activemq.injection@34.0.0.Beta1-SNAPSHOT//org.wildfly.extension.messaging.activemq.deployment.injection.AbstractJMSContext.getContext(AbstractJMSContext.java:29)
      

      The "<== monitors:1" logging in the stack trace shows where a monitor lock was acquired. The general fix is to move the blocking call out of whatever is happening that holds the monitor lock.

              ehugonne1@redhat.com Emmanuel Hugonnet
              bstansbe@redhat.com Brian Stansberry
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: