[
https://issues.apache.org/jira/browse/AMQ-5445?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Sergiy Barlabanov updated AMQ-5445:
-----------------------------------
Description:
When a Glassfish server is going down, messages being currently delivered to a
MDB, are acknowledged 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).
was:
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).
> Message acknowledged despite of an exception thrown by a message driven bean
> ----------------------------------------------------------------------------
>
> Key: AMQ-5445
> URL: https://issues.apache.org/jira/browse/AMQ-5445
> Project: ActiveMQ
> Issue Type: Bug
> Components: JCA Container
> Affects Versions: 5.10.0
> Environment: Windows, Glassfish 3.1.2.2 with AMQ RAR, ActiveMQ 5.10.0
> running standalone.
> Reporter: Sergiy Barlabanov
>
> When a Glassfish server is going down, messages being currently delivered to
> a MDB, are acknowledged 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
(v6.3.4#6332)