Closed mmyersDE closed 5 years ago
@mmerdes Thanks for the report. Could you please turn this into a complete project so it is easier for us to run. I know it is only a little work, but since there are lots of issues logged to the project a little * many issues adds up to a lot of time. Thanks!
https://github.com/mmyersDE/SPSS-7224
Your welcome
Thanks for the complete sample application.
This appears to be an issue with MockMvc not allowing multiple Threads to operate on the headers at the same time. It happens in Spring Security because the HeaderWriterFilter
will attempt to write the headers when it completes and just before the response is committed.
I pushed a branch named nosecurity that reproduces the issue without Spring Security being used to demonstrate the issue is in MockMvc rather than Spring Security. I'd encourage you to submit this issue to Spring Framework for the MockMvc team to look at.
Which release of Spring Framework is this fix available? Is it 5.1.11?
Summary
When using
mockMvc.perform
onMockMvcRequestBuilders.asyncDispatch
with a Spring Security configured applicationContext we receive aConcurrentModificationException
in approximately every 10th test-run. The Exception can be prevented by@DirtiesContext
, but this slows down the test alot and can not be used when callingmockMvc.perform
multiple times in a single test-method.Actual Behavior
Expected Behavior
Test finishes without error.
Version
Sample