Results 1 to 6 of 6

Thread: spring 2.5.1 a bug ?: ConcurrentModificationException

  1. #1

    Default spring 2.5.1 a bug ?: ConcurrentModificationException

    Hi,

    (sorry, I can not speak english)...

    I get the following exception, when I start a load test on a fresh servlet
    container (multiple threads). I do not receive the exception, if I execute the test by hand (single thread) and then the load test.

    Thanks for a tip.
    Torsten

    Code:
    java.util.ConcurrentModificationException
            at java.util.LinkedHashMap$LinkedHashIterator.remove(LinkedHashMap.java:356)
            at org.springframework.beans.factory.annotation.InjectionMetadata.doRegisterConfigMembers(InjectionMetadata.java:71)
            at org.springframework.beans.factory.annotation.InjectionMetadata.checkConfigMembers(InjectionMetadata.java:61)
            at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessMergedBeanDefinition(AutowiredAnnotationBeanPostProcessor.java:177)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyMergedBeanDefinitionPostProcessors(AbstractAutowireCapableBeanFactory.java:678)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:419)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:383)
            at java.security.AccessController.doPrivileged(Native Method)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:353)
            at org.springframework.beans.factory.support.AbstractBeanFactory$2.getObject(AbstractBeanFactory.java:283)
            at org.springframework.web.context.request.AbstractRequestAttributesScope.get(AbstractRequestAttributesScope.java:43)
            at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:279)
            at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
            at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:888)
            at org.springframework.web.jsf.DelegatingVariableResolver.resolveSpringBean(DelegatingVariableResolver.java:142)
            at org.springframework.web.jsf.DelegatingVariableResolver.resolveVariable(DelegatingVariableResolver.java:109)
            at com.sun.facelets.el.LegacyELContext$LegacyELResolver.

  2. #2
    Join Date
    Nov 2005
    Posts
    114

    Default

    Nothing to do with Spring. You have two iterators modifying in the same collection. Check your code

  3. #3

    Default

    Not right. Can You see any otther code in the stack trace as spring code?

    Here is the spring code:
    Code:
    private void doRegisterConfigMembers(RootBeanDefinition beanDefinition, Set<InjectedElement> members) {
    
      for (Iterator<InjectedElement> it = members.iterator(); it.hasNext();) {
    
        Member member = it.next().getMember();
    
          if (!beanDefinition.isExternallyManagedConfigMember(member)) {
            beanDefinition.registerExternallyManagedConfigMember(member);
          }
          else {
            it.remove();
          }
      }
    }

  4. #4
    Join Date
    Nov 2005
    Posts
    114

    Default

    Yep. Sorry, I should be more careful..
    But you give very little info about how you configure and run your test.
    Be more specific and if not me the spring team could have a look at it

  5. #5
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,625

    Default

    I think that you are not eagerly loading your configuration on server startup. Hence you are firing multiple requests very quick. The first request initializes the configuration, the second tries to use it but it is still in a creation process (or not there) and thus either has an illegal reference or tries to instantiate it as well.

    That also explains why it would work if you first do a request manually and afterwards start the loadtest.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  6. #6
    Join Date
    May 2008
    Posts
    14

    Default

    Just in case anyone finds this thread: I believe this was fixed in 2.5.5. See http://jira.springframework.org/browse/SPR-4932

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •