activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergiy Barlabanov (JIRA)" <>
Subject [jira] [Commented] (AMQ-5445) Message acknowledged despite of an exception thrown by a message driven bean
Date Thu, 20 Nov 2014 15:43:33 GMT


Sergiy Barlabanov commented on AMQ-5445:

And the patch would be I guess to extend the catch {} clause in org.apache.activemq.ActiveMQSession#run
and make it look something like this:

            } catch (Throwable e) {
                LOG.error("error dispatching message: ", e);
                // A problem while invoking the MessageListener does not
                // in general indicate a problem with the connection to the broker, i.e.
                // it will usually be sufficient to let the afterDelivery() method either
                // commit or roll back in order to deal with the exception.
                // However, we notify any registered client internal exception listener
                // of the problem.
                if (transactionContext != null && transactionContext.isInLocalTransaction())
                    try {
                    } catch (Throwable rollbackException) {
                        LOG.error("Error while trying to rollback the session", e);

or may be there is another way to let org.apache.activemq.ra.ServerSessionImpl#afterDelivery
know that it has to rollback instead of committing.

> Message acknowledged despite of an exception thrown by a message driven bean
> ----------------------------------------------------------------------------
>                 Key: AMQ-5445
>                 URL:
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: JCA Container
>    Affects Versions: 5.10.0
>         Environment: Windows, Glassfish with AMQ RAR, ActiveMQ 5.10.0 running
>            Reporter: Sergiy Barlabanov
> When a Glassfish server is going down, messages being currently delivered to a MDB, are
acknowledge with the 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).

This message was sent by Atlassian JIRA

View raw message