Skip to content

AOP and use of redirect view can lead to unbounded caching in AbstractAutoProxyCreator [SPR-17045] #21583

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

Closed
spring-projects-issues opened this issue Jul 16, 2018 · 2 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) in: web Issues in web modules (web, webmvc, webflux, websocket) status: backported An issue that has been backported to maintenance branches type: bug A general bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Jul 16, 2018

Andy Wilkinson opened SPR-17045 and commented

Please see the referenced Spring Boot issue for details. I have attached a minimal Boot app that reproduces the problem.

In short, the problem is that InternalResourceViewResolver calls AutowireCapableBeanFactory.initializeBean(Object existingBean, String beanName) using the complete URL as the beanName. The bean name is then used by AbstractAutoProxyCreator.wrapIfNecessary(Object, String, Object) as the key when it caches the fact that no advice applies to it. When the possible redirect URLs are unbounded this leads to an unbounded number of entries being added to the cache.


Affects: 4.3.18

Reference URL: spring-projects/spring-boot#13771

Attachments:

Issue Links:

Referenced from: commits b8d2a16, ae1d500, 19e944b

Backported to: 4.3.19

1 votes, 4 watchers

@spring-projects-issues
Copy link
Collaborator Author

zhao41654828 commented

I searched spr and found someone has reported the problem one year ago:

https://jira.spring.io/browse/SPR-15220?jql=text%20~%20%22AbstractAutoProxyCreator%20memory%22

 

Maybe more and more people will meet this problem...

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Jul 17, 2018

Juergen Hoeller commented

AbstractAutoProxyCreator is fundamentally right to make assumptions about the bean name: The supplied name should identify the kind of bean, not the individual instance. From that perspective, it's wrong for RedirectView to use the specified URL as bean name (as per #13413 when this was introduced); I've changed it to use the redirect prefix ("redirect:") to identify this kind of bean. Being at it, as of 5.1, we're also using the forward prefix ("forward:") for forward views (InternalResourceView) now, sending those through applyLifecycleMethods as well (even if just for the optional bean name and application context there since it may help for tracking).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) in: web Issues in web modules (web, webmvc, webflux, websocket) status: backported An issue that has been backported to maintenance branches type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants