Hello, I encountered this issue as well with ActiveMQ 5.6.0. I attached some debugging screenshots to this issue.
In my case, the messages are consumed fine during normal operation. It seems when JVM becomes busy doing gc, message(s) can be left in the queue forever until the server is restarted. It's not 100% reproducible but does occur. In the JConsole screenshot, you see ConsumerCount=1, InFlightCount=0, and QueueSize=1. A message is left unconsumed.
I debugged the ActiveMQ library code. Please see the debug-1.png and debug-2.png. A thread regularly iterates through the queue, finds the pending messages, and tries to page in messages from kaha db store by filling a batch. However, AbstractStoreCursor.fillBatch() doesn't execute doFillBatch(). And the execution thread finishes without dispatching the pending message to the consumer.
I don't know what the expected behavior should be, and I don't know if I were debugging the wrong part of the ActiveMQ code. ActiveMQ engineers, please let me know where else I should debug to help identify the problem. Thanks.