title: HornetQ timed out rollback leaves messages in DeliveringCount
body: <p>We have one <strong>app</strong> that does some very dynamic routing of <code>hornetq</code> messages so it reads from one queue and writes to another - within a single transacted session. The idea is that if we cannot move to the destination queue we won't remove it from the original queue. It works fine until we do some testing with network latency - things start to fall apart. </p>
  
  <p>Because of the latency the transacted cannot be committed and cannot be rolled back. We see a couple of thousands messages stuck in <code>deliverycount</code> and never clear out of there even after 20 minutes. We have the call timeout for the connection factory left at default - which is 30 seconds. The app has about 10 instances serving 8 different destination queues so you would think that if the delivering was being done sequentially we would not see more than 80 files stuck in <code>deliveringcount</code> but we do see way more than that.</p>
  
  <p>These files get out of the <code>deliveringCount</code> only when the app shuts of or if we kill and restart session.</p>
  
  <p>It seems that <strong>HornetQ</strong> is not able to timeout the transaction (you would think call timeout would do the trick maybe) and remove those files from <code>deliveringcount</code>.</p>
  
  <p>Is there any property that we should look at? I was looking for a transaction timeout but it comes only for <strong>XA transactions</strong> which we do not use.</p>
  
  <p>By the way we use a  <code>messagelistener</code> to receive the messages.</p>
  
  <p>Here is the error we get on the rollback timeout (there is a similar timeout error on the commit as well):</p>
  
  <pre><code>javax.jms.JMSException: HQ119014: Timed out waiting for response when sending packet 68
      at org.hornetq.core.protocol.core.impl.ChannelImpl.sendBlocking(ChannelImpl.java:379)
      at org.hornetq.core.client.impl.ClientSessionImpl.stop(ClientSessionImpl.java:726)
      at org.hornetq.core.client.impl.ClientSessionImpl.stop(ClientSessionImpl.java:712)
      at org.hornetq.core.client.impl.ClientSessionImpl.rollback(ClientSessionImpl.java:617)
      at org.hornetq.core.client.impl.ClientSessionImpl.rollback(ClientSessionImpl.java:597)
      at org.hornetq.core.client.impl.DelegatingSession.rollback(DelegatingSession.java:479)
      at org.hornetq.jms.client.HornetQSession.rollback(HornetQSession.java:250)
      at comms.HQRouter.MessageMover$MessageListenerImpl.onMessage(MessageMover.java:185)
      at org.hornetq.jms.client.JMSMessageListenerWrapper.onMessage(JMSMessageListenerWrapper.java:98)
      at org.hornetq.core.client.impl.ClientConsumerImpl.callOnMessage(ClientConsumerImpl.java:1085)
      at org.hornetq.core.client.impl.ClientConsumerImpl.access$400(ClientConsumerImpl.java:57)
      at org.hornetq.core.client.impl.ClientConsumerImpl$Runner.run(ClientConsumerImpl.java:1220)
      at org.hornetq.utils.OrderedExecutorFactory$OrderedExecutor$1.run(OrderedExecutorFactory.java:106)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
      at java.lang.Thread.run(Thread.java:744)
  Caused by: HornetQException[errorType=CONNECTION_TIMEDOUT message=HQ119014: Timed out waiting for response when sending packet 68]
      ... 16 more
  </code></pre>