Skip to content

Prevent corrupted ThreadLocals when mis-using triggerAfterCommit [SPR-11761] #16383

@spring-projects-issues

Description

@spring-projects-issues

Aldrin Seychell opened SPR-11761 and commented

This issue started when we noticed a number of missing data in our database and not matching our reports, all resulting from a particular thread. This problem was being triggered after utilizing the TransactionSynchronizationManager.registerSynchronization method and implementing the afterCompletion method to trigger a separate transaction to perform some further logic afterwards. However, when calling a method annotated with a @Transactional(propagation=NEVER), this seems to be corrupting the threadLocal variables and the transactional resources being tied to thread indefinitely. Any subsequent calls from this thread to persist new data will never reach the database but will never fail.


Affects: 3.1.1, 4.0.4

Reference URL: spring-attic/spring-framework-issues#74

Attachments:

Issue Links:

Referenced from: commits spring-attic/spring-framework-issues@8945dd9, spring-attic/spring-framework-issues@41578e8

1 votes, 4 watchers

Metadata

Metadata

Assignees

Labels

in: dataIssues in data modules (jdbc, orm, oxm, tx)status: duplicateA duplicate of another issuetype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions