6 Replies Latest reply on Nov 6, 2012 1:27 AM by Manu Srivastava

    Non-blocking producers not working

    Manu Srivastava Newbie



      We are using hornetq for our project where we do a JNDI lookup of the connection factory and create producers to send messages to durable queues. It looks like lots of threads are getting blocked in ChannelImpl.sendBlocking method. The documentation says that configuring the connection factory by setting block-on-durable-send to false will make the sends non-blocking (as it doesn't waits for response). I tried this but it seems somehow it is not working. Still getting the same issue.


      Any suggestions will be greatly appreciated.

        • 1. Re: Non-blocking producers not working
          Justin Bertram Master

          What address-full-policy are you using?

          • 2. Re: Non-blocking producers not working
            Manu Srivastava Newbie

            The address-full-policy being used was BLOCK. Now I have changed it to PAGE. But still in the stack trace, I can see threads getting blocked in ChannelImpl.sendBlocking. Don't know if I am right here, but hornetq code suggests that the threads should go to ChannelImpl.sendBatched (if it works correctly).

            • 3. Re: Non-blocking producers not working
              Clebert Suconic Master

              Are you using transactions?


              session.commit() or session.rollback() will also make a blocked call.


              I don't have the stack trace from you.. so that's my best guess.

              • 4. Re: Non-blocking producers not working
                Clebert Suconic Master

                You need to send it non-transactionally if you don't want it blocking. (there's no point on making a transaction if you want it unblocked. if you don't want to block means you can afford losing messages in case of failures... so no point on committs then)

                • 5. Re: Non-blocking producers not working
                  Manu Srivastava Newbie

                  We are already using non-transacted sessions. We have also set journal-sync-transactional and journal-sync-non-transactional to false. Given below is the stack trace I am getting:


                    Thread "pool-1-thread-20":

                      at org.hornetq.core.protocol.core.impl.ChannelImpl.sendBlocking(org.hornetq.core.protocol.core.Packet)

                      at org.hornetq.core.client.impl.ClientProducerImpl.doSend(org.hornetq.api.core.SimpleString, org.hornetq.api.core.Message)

                      at org.hornetq.core.client.impl.ClientProducerImpl.send(org.hornetq.api.core.SimpleString, org.hornetq.api.core.Message)

                      at org.hornetq.jms.client.HornetQMessageProducer.doSend(javax.jms.Message, long, org.hornetq.jms.client.HornetQDestination)

                      at org.hornetq.jms.client.HornetQMessageProducer.send(javax.jms.Destination, javax.jms.Message, int, int, long)

                      at com.bsb.hike.pubsub.jms.JMSProducer.send(javax.jms.Destination, javax.jms.TextMessage, int, int, long)

                      at com.bsb.hike.pubsub.jms.JMSProducer.send(java.lang.String, com.bsb.hike.common.HikeMessage)

                      at com.bsb.hike.pubsub.ProducerPool$MessageSendTask.run()

                      at java.util.concurrent.ThreadPoolExecutor.runWorker(java.util.concurrent.ThreadPoolExecutor$Worker)

                      at java.util.concurrent.ThreadPoolExecutor$Worker.run()

                      at java.lang.Thread.run()

                  • 6. Re: Non-blocking producers not working
                    Manu Srivastava Newbie

                    I just checked the connection factory instance. block-on-durable-send is still coming to be true (though I have set it to be false in the configuration). I programatically set it to false and now threads are not blocking.