-
Notifications
You must be signed in to change notification settings - Fork 38.4k
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
Avoid full singleton lock for DefaultSingletonBeanRegistry.getSingleton(beanName, false) #25667
Comments
Thanks @jhoeller for opening this ticket. This is an application startup issue. Please find below thread dump :- Thread 1:-
Thread 2:-
I am trying to establish connection to rabbit in the @PostConstruct method something like below:-
|
This will be available in the upcoming |
Thanks for fixing this issue quickly, I will surely let you know the results once the snapshot version is released. |
Could you please try the snapshot version? If there is an issue with that, that gives us some time to review the fix based on your feedback. |
To be clear, the latest snapshot build has the change already: https://repo.spring.io/snapshot/org/springframework/spring-framework-bom/5.2.9.BUILD-SNAPSHOT/spring-framework-bom-5.2.9.BUILD-20200831.160538-32.pom |
Sure, I will update you guys with results. This issue came in prod environment therefore need some time to replicate this into local development environment, please expect few days delay in this. Thanks for fix 👍 |
Closes spring-projectsgh-25667 (cherry picked from commit d8c420a)
Following up on the latest comments in #13117,
DefaultSingletonBeanRegistry.getSingleton(beanName, false)
seems to have a specific issue when called fromisSingleton
andisTypeMatch
checks inAbstractBeanFactory
: WhenisSingletonCurrentlyInCreation
returnstrue
, we're trying to enter the global lock for an early singleton exposure check... even if we're not allowed to create early references, so only able to check for an existing early reference. By turningearlySingletonObjects
into aConcurrentHashMap
and separating that early reference existence check from the creation of early references (which needs to happen within the global lock), we could potentially address a whole range of issues for lookup attempts in concurrent singleton creation scenarios.The text was updated successfully, but these errors were encountered: