1 Reply Latest reply on Feb 23, 2006 1:06 AM by Patrick

    Message queue deadlocks?

    Dmitry Shapovalov Newbie

      Hi, all

      I have three queues, all of them are serviced by the same MDB class. Each queue processing needs certain external resources, different for each queue. All messages are object messages. All messages use auto_acknowledge mode. There is a situation happens from time to time when resource is not available for one of queues (for an hour or more), so MDB can't successfully finish onMessage event, in which case MDB just creates new ObjectMessage with the same object and headers and redelivers it in the same queue. When it happens, messages from this queue get redelivered to the same queue very quickly for a long period of time. This can happen only for one queue from those three.
      What happens is that after some time of working in this mode two other queues get blocked, any attempt to send message to those two queues hang in this place forewer (well, at least for hours)

      private void internalSendMessage
      if (waitOnReply)
      { // Send a request msg and wait for the reply
      synchronized (msg)
      // Create the request msgID
      if (trace)
      log.trace("Begin internalSendMessage, round-trip msg=" + msg);
      // Place the msg into the write queue and reply map
      replyMap.put(msg, msg);
      // Wait for the msg reply
      it blocks on msg.wait(), so it never gets reply. Third queue (the one that gets quickly redelivered) works fine. I don't set any priorities for queues, they are all by default.
      Persistense is done on MySQL 5, MyISAM engine, so no transactions involved. JBoss 4.0.3SP1, EJB 2.1
      I would be happy to post any excerpts from the code or configuration or debug stacks, it's just a lot of stuff and i'm not sure what would be relevant.
      Any ideas about how it can be fixed or where should I look would be greatly appreciated