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

Fix infinite loop bug in AnnotationScanner #25429

Closed
wants to merge 3 commits into from

Conversation

yilianhuaixiao
Copy link
Contributor

The original code
isFiltered(source, context, classFilter) when true,
would cause dead circle.
Maybe new code is right.

@pivotal-issuemaster
Copy link

@yilianhuaixiao Please sign the Contributor License Agreement!

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

See the FAQ for frequently asked questions.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Jul 20, 2020
@pivotal-issuemaster
Copy link

@yilianhuaixiao Thank you for signing the Contributor License Agreement!

@sbrannen
Copy link
Member

Have you encountered an exception or some form of infinite loop in your code regarding your proposed change?

If so, please elaborate.

In any case, please add a test to this PR that fails before the proposed change and passes after the proposed change.

Thanks

@sbrannen sbrannen added in: core Issues in core modules (aop, beans, core, context, expression) status: waiting-for-feedback We need additional information before we can continue labels Jul 20, 2020
@sbrannen sbrannen changed the title fixed a bug Fix bug in AnnotationScanner Jul 20, 2020
@yilianhuaixiao
Copy link
Contributor Author

I add the testcase.
Before the bugfix, the testcase would cause infinite loop. After, the testcase could be passed.

@yilianhuaixiao
Copy link
Contributor Author

@sbrannen Thanks for your advice

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Jul 21, 2020
@sbrannen
Copy link
Member

I add the testcase.
Before the bugfix, the testcase would cause infinite loop. After, the testcase could be passed.

Thanks!

We'll look into it.

@sbrannen sbrannen self-assigned this Jul 22, 2020
@sbrannen sbrannen added this to the 5.3 M2 milestone Jul 22, 2020
@sbrannen
Copy link
Member

Tentatively slated for 5.3 M2 for investigation.

@sbrannen sbrannen changed the title Fix bug in AnnotationScanner Fix infinite recursion bug in AnnotationScanner Jul 22, 2020
@sbrannen sbrannen added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Jul 25, 2020
@sbrannen sbrannen modified the milestones: 5.3 M2, 5.2.9 Jul 25, 2020
@sbrannen sbrannen changed the title Fix infinite recursion bug in AnnotationScanner Fix infinite loop bug in AnnotationScanner Jul 25, 2020
sbrannen added a commit that referenced this pull request Jul 25, 2020
@sbrannen sbrannen closed this in 650cbee Jul 25, 2020
@sbrannen
Copy link
Member

This has been merged into master in 650cbee and revised in 5442d87.

Thanks!


@yilianhuaixiao, out of curiosity, since this code path is not executed in production code, how did you notice this bug?

sbrannen added a commit to sbrannen/spring-framework that referenced this pull request Jul 25, 2020
PR spring-projectsgh-25429 brought it to our attention that there was a bug in
AnnotationScanner when using a non-null class filter that filtered out
classes; however, it turns out that there is no production code that
utilizes the package-private class filtering support.

This commit therefore removes all class filtering support from
AnnotationScanner since that functionality was effectively unused.
@sbrannen
Copy link
Member

See also #25477

@yilianhuaixiao
Copy link
Contributor Author

@sbrannen I am learning the spring-core source codes rencently.

sbrannen added a commit to sbrannen/spring-framework that referenced this pull request Jul 28, 2020
PR spring-projectsgh-25429 brought it to our attention that there was a bug in
AnnotationScanner when using a non-null class filter that filtered out
classes; however, it turns out that there is no production code that
utilizes the package-private class filtering support.

This commit therefore removes all class filtering support from
AnnotationScanner since that functionality is effectively unused.

Closes spring-projectsgh-25477
FelixFly pushed a commit to FelixFly/spring-framework that referenced this pull request Aug 16, 2020
Prior to this commit, scanning for annotations resulted in an infinite
loop when using the INHERITED_ANNOTATIONS search strategy and a class
filter that filters out visited classes.

This commit avoids an infinite loop in AnnotationsScanner's
processClassInheritedAnnotations(...) method by skipping the current
level of the class hierarchy when the current source class has been
filtered out.

Closes spring-projectsgh-25429
FelixFly pushed a commit to FelixFly/spring-framework that referenced this pull request Aug 16, 2020
FelixFly pushed a commit to FelixFly/spring-framework that referenced this pull request Aug 16, 2020
PR spring-projectsgh-25429 brought it to our attention that there was a bug in
AnnotationScanner when using a non-null class filter that filtered out
classes; however, it turns out that there is no production code that
utilizes the package-private class filtering support.

This commit therefore removes all class filtering support from
AnnotationScanner since that functionality is effectively unused.

Closes spring-projectsgh-25477
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: feedback-provided Feedback has been provided type: bug A general bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants