Affects: spring-web version is 5.1.6
Comment From: sdd1989
Comment From: sbrannen
If you would like for us to look into this issue, please provide a minimal example that reproduces the problem.
In addition, please do not provide screenshots of stack traces. Instead, please copy and paste the stack trace as plain text.
Comment From: sdd1989
ok,thank you.
it is maybe not spring‘s issue, but I don’t know why parameter binding in Spring MVC occasionally results in a ConcurrentModificationException?
can you help me?
my stack trace is below
java.util.ConcurrentModificationException at java.util.LinkedHashMap$LinkedHashIterator.nextNode(LinkedHashMap.java:719) at java.util.LinkedHashMap$LinkedKeyIterator.next(LinkedHashMap.java:742) at java.util.Collections$3.nextElement(Collections.java:5216) at org.springframework.web.util.WebUtils.getParametersStartingWith(WebUtils.java:697) at org.springframework.web.bind.ServletRequestParameterPropertyValues.(ServletRequestParameterPropertyValues.java:80) at org.springframework.web.bind.ServletRequestParameterPropertyValues.(ServletRequestParameterPropertyValues.java:53) at org.springframework.web.bind.ServletRequestDataBinder.bind(ServletRequestDataBinder.java:101) at org.springframework.web.servlet.mvc.method.annotation.ServletModelAttributeMethodProcessor.bindRequestParameters(ServletModelAttributeMethodProcessor.java:157) at org.springframework.web.method.annotation.ModelAttributeMethodProcessor.resolveArgument(ModelAttributeMethodProcessor.java:160) at org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:126) at org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:166) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:134) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:892) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:797) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1038) at org.springframework.w exceptionInfo.nameLine:java.util.ConcurrentModificationException exceptionInfo.originLine:atjava.util.LinkedHashMap$LinkedHashIterator.nextNode(LinkedHashMap.java:719)
Comment From: sbrannen
Again, please provide a minimal example that reproduces the problem.
Otherwise it is very difficult for us to assist you.
Comment From: sdd1989
The code belongs to my company,can't put it in GitHub,so I would like to have a look first, Thank you anyway !
Comment From: sdd1989
Again, please provide a minimal example that reproduces the problem.
Otherwise it is very difficult for us to assist you.
Hello, I didn't find the answer to the question, but I find before request and after request the parameters are not changed. So I don't know why the ConcurrentModificationException occurs.
Ask for your help, See if it's a issues, a minimal example that reproduces the problem below
@SpringBootApplication()
@ImportResource("classpath:applicationContext.xml")
@componentscan(value = {"*"},
excludeFilters = {
@componentscan.Filter(type = FilterType.REGEX, pattern = "*"),
@componentscan.Filter(type = FilterType.REGEX, pattern = "*"),
@componentscan.Filter(type = FilterType.REGEX, pattern = "*")})
@MapperScan(basePackages = {"*"})
@EnableEurekaClient
@EnableFeignClients(basePackages = {"*"})
public class NewsFeedApiSpringbootApplication {
public static void main(String[] args) {
SpringApplication.run(NewsFeedApiSpringbootApplication.class, args);
}
}
@slf4j
@RequestMapping("/v4/task")
@RestController
public class TaskController {
@GetMapping("/tab/label")
public Result getTaskLabel(HttpServletRequest request, RequestContextBean bean,
@RequestParam(required = false, value = "test") String test,
@RequestParam(required = false, defaultValue = "0", value = "ts") long timestamp) {
//...
}
}
My package name omit,replace with *. My springboot version is 2.1.4.RELEASE
Thank you very much!
Comment From: sdd1989
It's not 100% reproducible, it's occasionally!
Comment From: rstoyanchev
@sdd1989 what we need is some way to reproduce the issue. We can't begin to debug the problem without that. The snippet you have provided does not help.
You'll need to to do further debugging in your own environment in order to narrow down the cause. It appears to be some concurrent modification of the Servlet request parameter map. That is unusual but this is why only you can debug it in your own environment. For example you might try to put breakpoints or print statements to see what's accessing or modifying the parameters.
I'm closing this for now, but if you find more information please feel free to provide it.
Comment From: sdd1989
@sdd1989 what we need is some way to reproduce the issue. We can't begin to debug the problem without that. The snippet you have provided does not help.
You'll need to to do further debugging in your own environment in order to narrow down the cause. It appears to be some concurrent modification of the Servlet request parameter map. That is unusual but this is why only you can debug it in your own environment. For example you might try to put breakpoints or print statements to see what's accessing or modifying the parameters.
I'm closing this for now, but if you find more information please feel free to provide it.
OK,Thank you anyway!