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

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

Closed
spring-issuemaster opened this issue Jul 16, 2018 · 2 comments

Comments

@spring-issuemaster
Copy link
Collaborator

@spring-issuemaster spring-issuemaster 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:

  • #13413 RequestDataValueProcessor not called in RedirectView
  • #19784 Decouple o.s.w.reactive.result.view.UrlBasedViewResolver from ApplicationContext

Referenced from: commits b8d2a16, ae1d500, 19e944b

Backported to: 4.3.19

1 votes, 4 watchers

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Jul 17, 2018

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-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster 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
Projects
None yet
2 participants
You can’t perform that action at this time.