Skip to content

Parameter resolution in SpringExtension is not thread-safe [SPR-17533] #22065

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 Nov 23, 2018 · 1 comment
Assignees
Labels
in: test Issues in the test module 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 Nov 23, 2018

Sam Brannen opened SPR-17533 and commented

Status Quo

ParameterAutowireUtils (used internally by the SpringExtension) creates a SynthesizingMethodParameter via SynthesizingMethodParameter.forParameter() which looks up the index of the current Parameter via MethodParameter.findParameterIndex(Parameter).

findParameterIndex() iterates over the array of parameters returned from java.lang.reflect.Executable.getParameters() which is unfortunately not thread-safe.

Specifically, the implementation of java.lang.reflect.Executable.privateGetParameters() writes to a private transient volatile Parameter[] parameters field in such a way that competing threads may receive references to different arrays.

Deliverables

  1. Ensure that parameter resolution within the SpringExtension is thread-safe.

Affects: 5.0.10, 5.1 GA

Reference URL: junit-team/junit5#1686

Issue Links:

Referenced from: commits 58cde3c, aa7f69a, cd67b28

Backported to: 5.0.11

@spring-projects-issues
Copy link
Collaborator Author

Sam Brannen commented

This has been fixed on master (5.1.3) and 5.0.x (5.0.11).

@spring-projects-issues spring-projects-issues added type: bug A general bug in: test Issues in the test module status: backported An issue that has been backported to maintenance branches labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 5.1.3 milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: test Issues in the test module 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