3 Replies Latest reply on Nov 26, 2011 11:31 PM by clebert.suconic

    Bug HornetQ not delivering message when a consumer unexpectedly exits

    magnus.hagstrom

      Hi

       

      I have been testing out message grouping in Hornetq, I found a bug when a consumer/client exits withou closing session/connection. To test you can kill the consumer ( kill -9 or similar ) . I have run this test on the latest version 2.2.5.

       

      My scenario I tested was this. Simulating an App. Server failure. Start up jconsole to monitor number of consumer and message count.

       

      Start hornetq

      Start 3 consumers.

      Send 10 msg with 3 different messagegroups, each consumer now gets 10 messages each.

      So far its all good.

      Now close down 1 consumer with kill -9

      IMPORTANT STEP

      Resend 10 msg with 3 different messagegroups again BEFORE HornetQ discovers that the consumer is dead. Monitor this in jconsole. You have a minute or 2.

       

      Now things goes wrong. You have 2 consumers running that should get a all messages you sent. But instead HornetQ delivers some (if you are lucky ) messages. It tries to deliver to the client you killed with kill -9 but fails, it will wait for a while and then put 1 message on DLQ, but the rest of the message for that group will remain in queue and no other messages will be delivered. If you start up a new consumer it will discover this new consumer and start delivering messages again.

       

      I guess a proper behavior should be that instead of putting that message on DLQ it should remove message from message group and assign that message group to an existing consumer.

       

      Attached files,  a simple consumer, a simple sender.