Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Timeout problem with Spring and Atomikos [SPR-14239] #18812

Closed
spring-projects-issues opened this issue May 2, 2016 · 4 comments
Closed

Timeout problem with Spring and Atomikos [SPR-14239] #18812

spring-projects-issues opened this issue May 2, 2016 · 4 comments
Assignees
Labels
in: data type: enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented May 2, 2016

Willian Constâncio da Silva opened SPR-14239 and commented

When using Spring and Atomikos, the timeout of a transaction is propagated to the next transaction in the same thread.
The problem occurs when the first transaction sets a timeout but the second one does not, leaving it as TransactionDefinition.TIMEOUT_DEFAULT.
If the timeout of the second transaction is set to zero the problem goes away.
Not sure if this is a Spring or a Atomikos bug.
Attached project shows the problem.


Affects: 4.2.5

Attachments:

Referenced from: commits 1be544f

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented May 2, 2016

Willian Constâncio da Silva commented

PS: Changing the JTA provider to Bitronix makes the problem go away too.

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented May 3, 2016

Juergen Hoeller commented

To my surprise, the JTA 1.2 UserTransaction.setTransactionTimeout javadoc indeed states the following: "Modify the timeout value that is associated with transactions started by the current thread with the begin method" as well as "If the value is zero, the transaction service restores the default value."

Even if Java EE arrangements typically interpret this as applying to the next transaction on the current thread only, the definition does imply that all subsequent transactions on the current thread could use this timeout. So to be on the safe side, we should explicitly reset the timeout through a setTransactionTimeout(0) call on the UserTransaction after each such transaction... I'll have a look at this for 4.3 still.

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented May 3, 2016

Juergen Hoeller commented

This will be available in the upcoming 4.3.0.BUILD-SNAPSHOT. Please give it a try if you have the chance...

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented May 3, 2016

Willian Constâncio da Silva commented

Works in the snapshot version!
Thanks for the fast response! :)

@spring-projects-issues spring-projects-issues added in: data type: enhancement labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 4.3 RC2 milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: data type: enhancement
Projects
None yet
Development

No branches or pull requests

2 participants