MessagingXAResource.isSameRM does not work after closing a connection
---------------------------------------------------------------------
Key: JBMESSAGING-1493
URL:
https://jira.jboss.org/jira/browse/JBMESSAGING-1493
Project: JBoss Messaging
Issue Type: Bug
Affects Versions: 1.4.2.GA
Reporter: Jeff Mesnil
Assignee: Tim Fox
Fix For: 1.4.0.SP3.CP06, 1.4.3.GA
There is an issue with MessagingXAResource.isSameRM(XAResource).
The method implementation delegates the check to the ResourceManager serverID integer.
However there can be cases where the method should not return true. For example:
1/ a transaction is started on a session xasess1 of conn1 -> conn1's resource
manager will hold the state of the tx
2/ conn1 is closed (e.g. due to a remoting failure), its session is closed, the tx is
removed from the resource manager and since it was the only connection holding the
resource manager, the resource manager is also removed
3/ a new connection conn2 is created -> conn2 creates a new instance of resource
manager (with the same serverID)
4/ a new session xasess2 is created from conn2
5/ MessagingXAResources.isSameRM is called: xasess2.isSameRM(xasses1)
-> it returns true (both resource manager have the same serverID)
6/ xasess2.start(xid, TMJOIN) is called
-> FAILURE: xasess2 resource manager does not hold the xid state.
In that case, MessagingXAResources.isSameRM returns true but the resource manager does not
hold the transaction state required to perform a TMJOIN.
What's more in SessionAspect.handleClose() (called when a session is closed), the tx
is removed from the transaction manager. This means that the tx is no longer in conn1
resource manager anyway.
We could fix the MessagingXAResource.isSameRM() implementation by not relying on the
serverID check only. We must also ensure that both MessagingXAResources shares the same
transactions map holding the tx states.
If we do that, MessagingXAResources.isSameRM will return false in the use case above and
we will call xasess2.start(TMNOFLAGS) with a new XID branch
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira