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

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

Closed
spring-issuemaster opened this Issue Nov 23, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@spring-issuemaster
Copy link
Collaborator

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

  • #22066 MethodParameter.findParameterIndex() is not thread-safe

Referenced from: commits 58cde3c, aa7f69a, cd67b28

Backported to: 5.0.11

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

spring-issuemaster commented Nov 23, 2018

Sam Brannen commented

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.