1 Reply Latest reply on Sep 2, 2011 3:25 AM by leosbitto

    a deadlock of sending message useing one producer instance

    oliverer

      er...

      I create one session connection ,and create a producer instance

       

      And then I start 4 threads to send message using the producer, but soon all the threads can't work

       

      I get the stacks and find the problem:

       

               "192.168.194.98-nsp.vfs-2" prio=10 tid=0x970da800 nid=0x7c95 waiting on condition [0x95d8a000]

      953    java.lang.Thread.State: WAITING (parking)

      954     at sun.misc.Unsafe.park(Native Method)

      955     - parking to wait for  <0xaf2e6e80> (a java.util.concurrent.Semaphore$NonfairSync)

      956     at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)

      957     at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:747)

      958     at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly(AbstractQueuedSynchronizer.java:905)

      959     at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1217)

      960     at java.util.concurrent.Semaphore.acquire(Semaphore.java:441)

      961     at org.hornetq.core.client.impl.ClientProducerCreditsImpl.acquireCredits(ClientProducerCreditsImpl.java:74)

      962     at org.hornetq.core.client.impl.ClientProducerImpl.doSend(ClientProducerImpl.java:305)

      963     at org.hornetq.core.client.impl.ClientProducerImpl.send(ClientProducerImpl.java:142)

      964     at org.hornetq.core.client.impl.ClientProducerImpl.send(ClientProducerImpl.java:147)

      965     at com.dbank.mq.client.hornetqimpl.ProducerImpl.send(ProducerImpl.java:36)

      966     at com.huawei.mq.sa.cgi.FastCGIHandlerThread.run(FastCGIHandlerThread.java:201)

      967

      968 "192.168.194.98-nsp.vfs-1" prio=10 tid=0x970d9000 nid=0x7c94 waiting on condition [0x95ddb000]

      969    java.lang.Thread.State: WAITING (parking)

      970     at sun.misc.Unsafe.park(Native Method)

      971     - parking to wait for  <0xaf2e6e80> (a java.util.concurrent.Semaphore$NonfairSync)

      972     at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)

      973     at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:747)

      974     at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly(AbstractQueuedSynchronizer.java:905)

      975     at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1217)

      976     at java.util.concurrent.Semaphore.acquire(Semaphore.java:441)

      977     at org.hornetq.core.client.impl.ClientProducerCreditsImpl.acquireCredits(ClientProducerCreditsImpl.java:74)

      978     at org.hornetq.core.client.impl.ClientProducerImpl.doSend(ClientProducerImpl.java:305)

      979     at org.hornetq.core.client.impl.ClientProducerImpl.send(ClientProducerImpl.java:142)

      980     at org.hornetq.core.client.impl.ClientProducerImpl.send(ClientProducerImpl.java:147)

      981     at com.dbank.mq.client.hornetqimpl.ProducerImpl.send(ProducerImpl.java:36)

      982     at com.huawei.mq.sa.cgi.FastCGIHandlerThread.run(FastCGIHandlerThread.java:201)

       

       

      What is the correct way to use the producer ?

      thanks very much

        • 1. Re: a deadlock of sending message useing one producer instance
          leosbitto

          Tim White wrote:

           

          er...

          I create one session connection ,and create a producer instance

           

          And then I start 4 threads to send message using the producer, but soon all the threads can't work

           

          :

          :

           

          What is the correct way to use the producer ?

          thanks very much

           

          Sessions and producers are not thread-safe. Possible solution is to create dedicated session and producer for each of your threads.