-
Notifications
You must be signed in to change notification settings - Fork 38.5k
Race condition in AutowiredAnnotationBeanPostProcessor [SPR-11022] #15650
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
Comments
Piotr Findeisen commented I've created a repro project, spring-attic/spring-framework-issues#59 |
Piotr Findeisen commented This looks very similar to #12291, #9607, #10329 but all those issues should be fixed in my version (3.1.2), so I assume this is not a duplicate of those issues. |
Phil Webb commented I have merged your repo issue [1] but after upgrading to Spring 3.1.4 it appears to pass. Could you please verify with that release and re-open this issue if you still see problems. |
Piotr Findeisen commented thanks for your prompt reply. Have you been able to reproduce the bug using |
Piotr Findeisen commented From code reading -- this does not affect |
Phil Webb commented Yes, The repro project you submitted failed on 3.1.2 but not 3.1.4 |
Piotr Findeisen commented Oh, good, thanks! So I confirm, we see the same. Could you please change resolution to something more adequate? 'Fixed' perhaps (since bug existed but is fixed)? Or 'Obsolete'? I'm afraid someone looking at 'Cannot reproduce' resolution may think it was just a bogus bug report and they may not consider this a reason to upgrade to 3.1.4. |
Phil Webb commented I have marked it as Duplicate since I assume that it was raised and fixed previously. |
Piotr Findeisen commented Thanks! Btw. I see that the only commit between 3.1.2 and 3.1.4 towards It does not change how the Anyway -- thanks! (I still will have problem upgrading Spring to 3.1.4 because of #15623) |
Piotr Findeisen opened SPR-11022 and commented
The -
AutowiredAnnotationBeanPostProcessor.AutowiredFieldElement
and-AutowiredAnnotationBeanPostProcessor.AutowiredMethodElement
have double-check pattern and this results in a serious race condition resulting in@Autowired
-field-/methods not being autowired.Explanation
In both -
AutowiredFieldElement
,-AutowiredMethodElement
thevolatile boolean cached
guardsvolatile Object[] cachedMethodArguments
but when thecachedMethodArguments
is populated the order is as follows:cachedMethodArguments
to new array (all fields null)cachedMethodArguments
is volatilecachedMethodArguments
cached = true
cached
is volatilecached=true
,cachedMethodArguments
not null, but its contents may be pretty anythingsolution
cachedMethodArguments
only after this array is fully created and populatedAffects: 3.1.2
Referenced from: commits spring-attic/spring-framework-issues@57002b6, spring-attic/spring-framework-issues@da21a32, spring-attic/spring-framework-issues@a6f2f61
The text was updated successfully, but these errors were encountered: