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

TransactionalTemplate#execute doesn't call GlobalTransactionContext#clean, which result in leaking ThreadLocal variables #313

Closed
1 task done
tankilo opened this issue Jan 28, 2019 · 5 comments · Fixed by #354
Labels
type: bug Category issues or prs related to bug.

Comments

@tankilo
Copy link
Contributor

tankilo commented Jan 28, 2019

  • I have searched the issues of this repository and believe that this is not a duplicate.

Ⅰ. Issue Description

TransactionalTemplate#execute doesn't call GlobalTransactionContext#clean, which result in leaking ThreadLocal variables

Ⅱ. Describe what happened

First method call
image

Second method call, the xid that leaked by the first method call can still be achieved!!!
image

image

Ⅲ. Describe what you expected to happen

After exiting method TransactionalTemplate#execute, any ThreadLocal variables of the global transaction which are newly created by this method call should be cleared.
Just like Spring JDBC, the outside transaction aop method should clean up the resources that it created.

Ⅳ. How to reproduce it (as minimally and precisely as possible)

I have a project fescar-test, you need to edit Simple.java first to bypass #312

image

Ⅴ. Anything else we need to know?

Ⅵ. Environment:

  • JDK version :
  • OS :
  • Others:
tankilo added a commit to tankilo/fescar that referenced this issue Jan 28, 2019
@sharajava sharajava added the type: bug Category issues or prs related to bug. label Jan 29, 2019
@sharajava
Copy link
Contributor

Could you please give a reproducing steps for this issue?

@tankilo
Copy link
Contributor Author

tankilo commented Jan 29, 2019

Could you please give a reproducing steps for this issue?
please check README.md in my project.

@shanbing
Copy link

I use it in spring boot enviroment,this is happend too,because tomcat use thread pool.
I think it should clean when method DefaultGlobalTransaction#clean and commit.

@tankilo
Copy link
Contributor Author

tankilo commented Jan 30, 2019

@slievrly
#325 Bring new probelms in nested transaction scenes!!!

Please check section [fescar-test-nestedsession] in my project

image
image

Inner transaction will commit the outer transaction, though they are the same transaction. This is wrong because the commit or rolllback of the global transaction should be done by the outer transaction.
image

When the outer transaction come back to rollback, the undo_log has already been cleared by the inner transaction.
image
image

image

@slievrly
Copy link
Member

@tankilo nest inner Trx commit/rollback cause the whole Trx commit/rollback?

tankilo added a commit to tankilo/fescar that referenced this issue Jan 30, 2019
tankilo added a commit to tankilo/fescar that referenced this issue Jan 30, 2019
tankilo added a commit to tankilo/fescar that referenced this issue Jan 30, 2019
tankilo added a commit to tankilo/fescar that referenced this issue Jan 30, 2019
tankilo added a commit to tankilo/fescar that referenced this issue Jan 31, 2019
tankilo added a commit to tankilo/fescar that referenced this issue Jan 31, 2019
tankilo added a commit to tankilo/fescar that referenced this issue Jan 31, 2019
tankilo added a commit to tankilo/fescar that referenced this issue Jan 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Category issues or prs related to bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants