Parameter resolution in SpringExtension is not thread-safe [SPR-17533] #22065
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
Sam Brannen opened SPR-17533 and commented
Status Quo
ParameterAutowireUtils
(used internally by theSpringExtension
) creates aSynthesizingMethodParameter
viaSynthesizingMethodParameter.forParameter()
which looks up the index of the currentParameter
viaMethodParameter.findParameterIndex(Parameter)
.findParameterIndex()
iterates over the array of parameters returned fromjava.lang.reflect.Executable.getParameters()
which is unfortunately not thread-safe.Specifically, the implementation of
java.lang.reflect.Executable.privateGetParameters()
writes to aprivate transient volatile Parameter[] parameters
field in such a way that competing threads may receive references to different arrays.Deliverables
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
The text was updated successfully, but these errors were encountered: