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

Add default hashCode implementation to RetryConfiguration.AnnotationClassOrMethodPointcut #472

Conversation

NorsaG
Copy link
Contributor

@NorsaG NorsaG commented Sep 23, 2024

This pull request introduces a default implementation of hashCode for RetryConfiguration.AnnotationClassOrMethodPointcut.

I discovered that using Spring Cloud with configuration refreshing (specifically the @RefreshScope annotation and ConfigServicePropertySourceLocator as part of spring-cloud-config) can lead to a "java.lang.OutOfMemoryError: Metaspace". This occurs because the ConfigServicePropertySourceLocator is re-initialized with every refresh. Due to the absence of a hashCode implementation, proxies for this class are regenerated each time, which causes them to be stored in the org.springframework.cglib.core.internal.LoadingCache (with RetryConfiguration.AnnotationClassOrMethodPointcut being part of the composite key for this object).
This results in an excessive accumulation of generated proxies in memory, ultimately leading to metaspace overflow.

@pivotal-cla
Copy link

@NorsaG Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

@pivotal-cla
Copy link

@NorsaG Thank you for signing the Contributor License Agreement!

@artembilan artembilan added this to the 2.0.10 milestone Sep 23, 2024
Copy link
Member

@artembilan artembilan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update Copyright of the changed class to actual year.
Add you name to the @author list.

Thanks

@NorsaG NorsaG force-pushed the AnnotationClassOrMethodPointcut-hashCode-implementation branch from dfc2ee9 to 492e03d Compare September 23, 2024 17:15
@NorsaG NorsaG force-pushed the AnnotationClassOrMethodPointcut-hashCode-implementation branch from 80d4edf to b4c9058 Compare September 23, 2024 17:16
@NorsaG
Copy link
Contributor Author

NorsaG commented Sep 23, 2024

Fit the PR according to the comment.

@artembilan artembilan merged commit 76b41e8 into spring-projects:main Sep 23, 2024
2 checks passed
@artembilan
Copy link
Member

@NorsaG ,

thank you for contribution; looking forward for more!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants