java.util.ConcurrentModificationException

Spring JIRA | Hendy Irawan | 1 year ago
  1. 0

    It's hard to reproduce this even for me. It only happens once and then the app works normally. Using Spring Boot 1.2.3 webapp. While Spring Boot is still initializing, and trying to open a webpage (an MVC controller request method), this could happen. So it seems {{appCtx.getBean(Class)}} is not fully thread-safe: {code:java} final WebApplicationContext appCtx = WebApplicationContextUtils.getRequiredWebApplicationContext( ((ServletRequest) request.getContainerRequest()).getServletContext()); final GoogleSysConfig sysConfig = appCtx.getBean(GoogleSysConfig.class); {code} Stack trace: {noformat} Unexpected RuntimeException Last cause: null Stacktrace Root cause: java.util.ConcurrentModificationException at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:901) at java.util.ArrayList$Itr.next(ArrayList.java:851) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:423) at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:412) at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:398) at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:337) at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:331) at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:968) at org.soluvas.web.site.google.GoogleVerifyRequestMapper.mapRequest(GoogleVerifyRequestMapper.java:76) at org.apache.wicket.request.mapper.CompoundRequestMapper.mapRequest(CompoundRequestMapper.java:152) at org.apache.wicket.request.cycle.RequestCycle.resolveRequestHandler(RequestCycle.java:190) at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:215) at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:289) at org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:259) at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:201) at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:282) at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60) at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132) at org.springframework.boot.actuate.trace.WebRequestTraceFilter.doFilterInternal(WebRequestTraceFilter.java:102) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60) at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:85) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60) at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132) at org.springframework.boot.actuate.autoconfigure.MetricFilterAutoConfiguration$MetricsFilter.doFilterInternal(MetricFilterAutoConfiguration.java:90) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60) at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132) at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:85) at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61) at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131) at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:56) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45) at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:63) at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58) at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:70) at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at io.undertow.servlet.handlers.ServletInitialHandler.jrHandle(ServletInitialHandler.java) at org.zeroturnaround.javarebel.integration.servlet.undertow.cbp.ServletInitialHandlerCBP.handleRequest(ServletInitialHandlerCBP.java:104) at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:261) at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:247) at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:76) at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:166) at io.undertow.server.Connectors.executeRootHandler(Connectors.java:197) at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:765) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) display page view {noformat} Related to SPR-259.

    Spring JIRA | 1 year ago | Hendy Irawan
    java.util.ConcurrentModificationException
  2. 0

    It's hard to reproduce this even for me. It only happens once and then the app works normally. Using Spring Boot 1.2.3 webapp. While Spring Boot is still initializing, and trying to open a webpage (an MVC controller request method), this could happen. So it seems {{appCtx.getBean(Class)}} is not fully thread-safe: {code:java} final WebApplicationContext appCtx = WebApplicationContextUtils.getRequiredWebApplicationContext( ((ServletRequest) request.getContainerRequest()).getServletContext()); final GoogleSysConfig sysConfig = appCtx.getBean(GoogleSysConfig.class); {code} Stack trace: {noformat} Unexpected RuntimeException Last cause: null Stacktrace Root cause: java.util.ConcurrentModificationException at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:901) at java.util.ArrayList$Itr.next(ArrayList.java:851) at org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:423) at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:412) at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:398) at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:337) at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:331) at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:968) at org.soluvas.web.site.google.GoogleVerifyRequestMapper.mapRequest(GoogleVerifyRequestMapper.java:76) at org.apache.wicket.request.mapper.CompoundRequestMapper.mapRequest(CompoundRequestMapper.java:152) at org.apache.wicket.request.cycle.RequestCycle.resolveRequestHandler(RequestCycle.java:190) at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:215) at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:289) at org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:259) at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:201) at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:282) at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60) at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132) at org.springframework.boot.actuate.trace.WebRequestTraceFilter.doFilterInternal(WebRequestTraceFilter.java:102) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60) at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:85) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60) at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132) at org.springframework.boot.actuate.autoconfigure.MetricFilterAutoConfiguration$MetricsFilter.doFilterInternal(MetricFilterAutoConfiguration.java:90) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60) at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132) at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:85) at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61) at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131) at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:56) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45) at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:63) at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58) at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:70) at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at io.undertow.servlet.handlers.ServletInitialHandler.jrHandle(ServletInitialHandler.java) at org.zeroturnaround.javarebel.integration.servlet.undertow.cbp.ServletInitialHandlerCBP.handleRequest(ServletInitialHandlerCBP.java:104) at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:261) at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:247) at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:76) at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:166) at io.undertow.server.Connectors.executeRootHandler(Connectors.java:197) at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:765) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) display page view {noformat} Related to SPR-259.

    Spring JIRA | 1 year ago | Hendy Irawan
    java.util.ConcurrentModificationException
  3. 0

    Investigate concurrent modification exception

    GitHub | 2 years ago | rtyler
    java.util.ConcurrentModificationException
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Can't Add Scene in main() Function Of GameObject

    GitHub | 2 years ago | SolarLune
    java.util.ConcurrentModificationException
  6. 0

    Restarting Scene Results in Crash

    GitHub | 2 years ago | SolarLune
    java.util.ConcurrentModificationException

  1. serious2monkeys 2 times, last 1 month ago
  2. eti22 4 times, last 2 months ago
  3. Tahir 1 times, last 3 months ago
  4. Shadd518 2 times, last 4 months ago
  5. haerick 1 times, last 6 months ago
5 more registered users
23 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.util.ConcurrentModificationException

    No message provided

    at java.util.ArrayList$Itr.checkForComodification()
  2. Java RT
    ArrayList$Itr.next
    1. java.util.ArrayList$Itr.checkForComodification(ArrayList.java:901)
    2. java.util.ArrayList$Itr.next(ArrayList.java:851)
    2 frames
  3. Spring Beans
    DefaultListableBeanFactory.getBean
    1. org.springframework.beans.factory.support.DefaultListableBeanFactory.doGetBeanNamesForType(DefaultListableBeanFactory.java:423)
    2. org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:412)
    3. org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:398)
    4. org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:337)
    5. org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:331)
    5 frames
  4. Spring Context
    AbstractApplicationContext.getBean
    1. org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:968)
    1 frame
  5. org.soluvas.web
    GoogleVerifyRequestMapper.mapRequest
    1. org.soluvas.web.site.google.GoogleVerifyRequestMapper.mapRequest(GoogleVerifyRequestMapper.java:76)
    1 frame
  6. Wicket Request
    CompoundRequestMapper.mapRequest
    1. org.apache.wicket.request.mapper.CompoundRequestMapper.mapRequest(CompoundRequestMapper.java:152)
    1 frame
  7. Wicket Core
    WicketFilter.doFilter
    1. org.apache.wicket.request.cycle.RequestCycle.resolveRequestHandler(RequestCycle.java:190)
    2. org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:215)
    3. org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:289)
    4. org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:259)
    5. org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:201)
    6. org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:282)
    6 frames
  8. Undertow Servlet
    FilterHandler$FilterChainImpl.doFilter
    1. io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60)
    2. io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132)
    2 frames
  9. Spring Boot Actuator
    WebRequestTraceFilter.doFilterInternal
    1. org.springframework.boot.actuate.trace.WebRequestTraceFilter.doFilterInternal(WebRequestTraceFilter.java:102)
    1 frame
  10. Spring
    OncePerRequestFilter.doFilter
    1. org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    1 frame
  11. Undertow Servlet
    FilterHandler$FilterChainImpl.doFilter
    1. io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60)
    2. io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132)
    2 frames
  12. Spring
    OncePerRequestFilter.doFilter
    1. org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:85)
    2. org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    2 frames
  13. Undertow Servlet
    FilterHandler$FilterChainImpl.doFilter
    1. io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60)
    2. io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132)
    2 frames
  14. Spring Boot Actuator
    MetricFilterAutoConfiguration$MetricsFilter.doFilterInternal
    1. org.springframework.boot.actuate.autoconfigure.MetricFilterAutoConfiguration$MetricsFilter.doFilterInternal(MetricFilterAutoConfiguration.java:90)
    1 frame
  15. Spring
    OncePerRequestFilter.doFilter
    1. org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    1 frame
  16. Undertow Servlet
    ServletAuthenticationCallHandler.handleRequest
    1. io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60)
    2. io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132)
    3. io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:85)
    4. io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61)
    5. io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
    6. io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
    7. io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:56)
    7 frames
  17. Undertow Core
    AbstractConfidentialityHandler.handleRequest
    1. io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
    2. io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45)
    2 frames
  18. Undertow Servlet
    ServletConfidentialityConstraintHandler.handleRequest
    1. io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:63)
    1 frame
  19. Undertow Core
    AuthenticationMechanismsHandler.handleRequest
    1. io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58)
    1 frame
  20. Undertow Servlet
    CachedAuthenticatedSessionHandler.handleRequest
    1. io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:70)
    1 frame
  21. Undertow Core
    PredicateHandler.handleRequest
    1. io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76)
    2. io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
    3. io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
    3 frames
  22. Undertow Servlet
    ServletInitialHandler.jrHandle
    1. io.undertow.servlet.handlers.ServletInitialHandler.jrHandle(ServletInitialHandler.java)
    1 frame
  23. org.zeroturnaround.javarebel
    ServletInitialHandlerCBP.handleRequest
    1. org.zeroturnaround.javarebel.integration.servlet.undertow.cbp.ServletInitialHandlerCBP.handleRequest(ServletInitialHandlerCBP.java:104)
    1 frame
  24. Undertow Servlet
    ServletInitialHandler$1.handleRequest
    1. io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:261)
    2. io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:247)
    3. io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:76)
    4. io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:166)
    4 frames
  25. Undertow Core
    HttpServerExchange$1.run
    1. io.undertow.server.Connectors.executeRootHandler(Connectors.java:197)
    2. io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:765)
    2 frames
  26. Java RT
    Thread.run
    1. java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    2. java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    3. java.lang.Thread.run(Thread.java:745)
    3 frames