Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.0, 1.0.1, 1.1, 1.2, 1.3
-
Fix Version/s: 1.3
-
Labels:None
-
Patch Submitted:Yes
-
Number of attachments :
Description
If a resource rolls back for some reason (e.g. a timeout), XAResource.end() may throw any of XA_RB* or it may even completely drop the transaction and throw XAER_NOTA. Currently BTM completely ignores this and attempts to prepare and commit as normal anyway. While things generally end up correct because either prepare or commit (in the 1PC case) will also throw a XA_RB* or XA_HEUR* or XAER_NOTA, it leads to numerous other exceptions, often logged at level WARN.
Attached is a patch that recognizes XA_RB* and XAER_NOTA from XAResource.end() and causes BTM to roll back in an orderly fashion. Note that for completeness sake XAResource.start() should have similar handling, but I was too lazy to implement that.
For reference, this behaviour is documented in the X/Open spec on pages 37 ff (xa_end), page 62 (state tables), page 15 ("Rollback-Only", last two sentences), page 18 ("Unilateral RM Action"), and possibly elsewhere.
Interesting. I've seen this happening with Sybase ASE but didn't know exactly how to handle that until now, thanks for the clarification.
I'll read the XA spec chapters you referenced, review your patch and try to get it merged in for 1.3.