-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Description
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
- Ensure that parameter resolution within the
SpringExtension
is thread-safe.
Affects: 5.0.10, 5.1 GA
Reference URL: junit-team/junit-framework#1686
Issue Links:
- MethodParameter.findParameterIndex() is not thread-safe [SPR-17534] #22066 MethodParameter.findParameterIndex() is not thread-safe
Referenced from: commits 58cde3c, aa7f69a, cd67b28
Backported to: 5.0.11