Skip to content

Multi resource XA transactions sometimes act incorrectly [SPR-12535] #17140

Closed
@spring-projects-issues

Description

@spring-projects-issues

Trevor Stevens opened SPR-12535 and commented

When using XA Transactions sometimes messages are delivered to the queue before they are committed to the database. We have attempted the following within both TomEE and Wildfly and have been able to reproduce this issue in both. I'm attaching a sample project which should allow others to reproduce this as well.

Expected operation, each step represents a seperate XA transaction.

  1. @Service send JMSMessage using JMSTemplate
  2. Listener1 within a DefaultMessageListenerContainer uses JPA to persists entity and sends a JMSMessage containing ID of entity using JMSTemplate
  3. Listener2 within a DefaultMessageListenerContainer attempts to retrieve entity by ID from JPA

My thought was that within an XA transaction both the JPA persist and the JMS send must complete before the transaction can commit successfully. We have been trying to tackle a strange case where after the listener for #2 completes the message from #2 is then delivered to #3 but the ID is not present in the database yet and the entity cannot be retreived.

I'm attaching a snippent from a log showing both a passing and failing case of the above steps. Since we have been unable to find any fault with our configuration and due the intermittent nature of this we can only assume that a bug exists somewhere within Springs handling of XA transactions.


Affects: 3.2.12

Reference URL: https://github.com/jej2003/simple-spring

Attachments:

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)in: dataIssues in data modules (jdbc, orm, oxm, tx)status: invalidAn issue that we don't feel is valid

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions