Uploaded image for project: 'ActiveMQ'
  1. ActiveMQ
  2. AMQ-5445

Message acknowledged despite of an exception thrown by a message driven bean

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 5.10.0
    • None
    • JCA Container
    • None
    • Windows, Glassfish 3.1.2.2 with AMQ RAR, ActiveMQ 5.10.0 running standalone.

    Description

      When a Glassfish server is going down, messages being currently delivered to a MDB, are acknowledged with the following message coming from org.apache.activemq.ra.ServerSessionImpl:

      Local transaction had not been commited. Commiting now.

      Having analyzed the problem, we discovered, that when Glassfish is going down the method endpoint#beforeDelivery (org.apache.activemq.ra.ServerSessionImpl#beforeDelivery) does not start an XA transaction. So ActiveMQ starts a local transaction in org.apache.activemq.ActiveMQSession#doStartTransaction. After that ActiveMQSession#run tries to call messageListener.onMessage() and it fails with an exception. Exception is handled in ActiveMQSession#run, but is not propagated to org.apache.activemq.ra.ServerSessionImpl#afterDelivery. And in org.apache.activemq.ra.ServerSessionImpl#afterDelivery there is finally {} clause, which commits the session if there is local transaction (and there is one - see above) despite the exception occurred before.
      This last commit seems to be inappropriate. In case of a transaction (local or not) the corresponding message may not be acknowledged - it must be rollbacked (no session commit).

      Attachments

        Activity

          People

            Unassigned Unassigned
            barlabanov Sergiy Barlabanov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: