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

Put a limit on the size of DefaultSingletonBeanRegistry#suppressedExceptions #24902

Closed
kennymacleod opened this issue Apr 13, 2020 · 0 comments
Closed
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: backported An issue that has been backported to maintenance branches type: enhancement A general enhancement
Milestone

Comments

@kennymacleod
Copy link

Spring 5.1.8

Whilst converting a particularly complex ball-of-mud legacy application from XML config to @Configuration-style config, I am finding that diagnosing circular references that trigger BeanCurrentlyInCreationExceptions causes an OutOfMemoryError before any actual exception is thrown during context initialisation. This doesn't happn with the pure XML-based config, only when I mix Java and XML styles.

When I look at the hprof file, 96% of the 2.5GB heap is retained by the DefaultSingletonBeanRegistry#suppressedExceptions field, which is full of massively-nested BeanCreationExceptions - 12592 of them, in this case.

It woul make sense to me if the suppressedExceptions field were to have a size limiter added, to prevent it growing so large. It's only there for diagnostics, and 12000+ exceptons isn't going to help anyone. I on't know what a sensible size imit would be, but more than a few dozen would seem to be unecessary and unhelpful.

In my case, the limiter would at least allow the context init to fail "gracefully". I don't know what it is about my set up, but its much too complex for me to post as a test case, sorry.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Apr 13, 2020
@sbrannen sbrannen added the in: core Issues in core modules (aop, beans, core, context, expression) label Apr 14, 2020
@jhoeller jhoeller self-assigned this Apr 14, 2020
@jhoeller jhoeller added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Apr 14, 2020
@jhoeller jhoeller added this to the 5.2.6 milestone Apr 14, 2020
@jhoeller jhoeller added the for: backport-to-5.1.x Marks an issue as a candidate for backport to 5.1.x label Apr 25, 2020
@spring-projects-issues spring-projects-issues added status: backported An issue that has been backported to maintenance branches and removed for: backport-to-5.1.x Marks an issue as a candidate for backport to 5.1.x labels Apr 25, 2020
zx20110729 pushed a commit to zx20110729/spring-framework that referenced this issue Feb 18, 2022
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) status: backported An issue that has been backported to maintenance branches type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

4 participants