Skip to content

Circular reference of request scoped beans throws OutOfMemoryError or infinite loop. [SPR-2767] #7455

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 Oct 27, 2006 · 3 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) in: web Issues in web modules (web, webmvc, webflux, websocket) type: bug A general bug
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

spring-projects-issues commented Oct 27, 2006

Mike Youngstrom opened SPR-2767 and commented

If I have two request scoped beans who reference each other when I attempt to load one of those beans I get an OutOfMemoryException because of an infinite loop.

Example:

<bean name="someBean" scope="request">
<property name="someOtherBean" ref="someOtherBean"/>
</bean>
<bean name="someOtherBean" scope="request">
<property name="someBean" ref="someBean"/>
</bean>

Even if circular references of non singleton scoped beans is not supported we should probably not have an infinite loop if it's possible to avoid.

Mike


Affects: 2.0 final

Issue Links:

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Oct 27, 2006

Juergen Hoeller commented

As outlined in #7379, I have already added a check that throws a corresponding exception instead of the endless loop. This is already in CVS and should make it into the next nightly snapshot.

Juergen

@spring-projects-issues
Copy link
Collaborator Author

Mike Youngstrom commented

Sounds good to me thanks for the clarification.....sorry about the extra bug report I wasn't sure if the other one was being ignored or not because it was targeted towards custom scopes and not request or session scopes. :) Anyway, thanks.

Mike

@spring-projects-issues
Copy link
Collaborator Author

spring-projects-issues commented Oct 28, 2006

Juergen Hoeller commented

Fixed in that a proper exception is thrown instead of an endless loop now.

I'll still keep #7379 open for the time being, since the issue of whether circular references should be supported for non-singletons has been explicitly raised there.

Juergen

@spring-projects-issues spring-projects-issues added type: bug A general bug in: core Issues in core modules (aop, beans, core, context, expression) in: web Issues in web modules (web, webmvc, webflux, websocket) labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 2.0.1 milestone Jan 11, 2019
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) type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants