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

Inconsistent synchronization in AbstractBeanFactoryBasedTargetSource and JdbcAccessor [SPR-16570] #21112

spring-projects-issues opened this issue Mar 8, 2018 · 0 comments
in: core in: data status: backported type: bug


Copy link

@spring-projects-issues spring-projects-issues commented Mar 8, 2018

Juergen Hoeller opened SPR-16570 and commented

As pointed out by #1725, AbstractBeanFactoryBasedTargetSource.getTargetClass() and JdbcAccessor.getExceptionTranslator() are marked as synchronized but their corresponding setter methods aren't... which may lead to inconsistent visibility at runtime.

Since all we want to prevent there is entering the lazy initialization algorithm concurrently, we can use a volatile field instead, only entering full synchronization when no existing instance has been found. Once initialized, we're happy to go with whatever has been set, so a volatile field is sufficient there.

Affects: 4.3.14, 5.0.4

Referenced from: commits a403a75, 7f1a8d7, 207e8c2, 1bde920, 50253f6

Backported to: 4.3.15

@spring-projects-issues spring-projects-issues added type: bug in: data status: backported in: core labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 5.0.5 milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
in: core in: data status: backported type: bug
None yet

No branches or pull requests

2 participants