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-issuemaster opened this issue May 2, 2016 · 4 comments
Closed

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

spring-issuemaster opened this issue May 2, 2016 · 4 comments
Assignees
Milestone

Comments

@spring-issuemaster
Copy link
Collaborator

@spring-issuemaster spring-issuemaster 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-issuemaster
Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented May 2, 2016

Willian Constâncio da Silva commented

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

@spring-issuemaster
Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster 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-issuemaster
Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster 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-issuemaster
Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented May 3, 2016

Willian Constâncio da Silva commented

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.