- 
                Notifications
    You must be signed in to change notification settings 
- Fork 38.8k
Closed
Closed
Copy link
Labels
status: backportedAn issue that has been backported to maintenance branchesAn issue that has been backported to maintenance branchestype: enhancementA general enhancementA general enhancement
Milestone
Description
Spencer Gibb opened SPR-12428 and commented
While trying to call PropertySourcesPropertyResolver.containsProperty from one thread, another thread has added a new PropertySource and then the ConcurrentModificationException is thrown.
This code in Spring Boot adds the property source in a ContextRefreshedEvent handler. https://github.com/spring-projects/spring-boot/blob/master/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/EndpointWebMvcAutoConfiguration.java#L228
[2014-11-12 15:30:35.201] boot - 93750 ERROR [Thread-3] --- ConcurrentMapConfiguration: Error firing configuration event
java.util.ConcurrentModificationException
    at java.util.LinkedList$ListItr.checkForComodification(LinkedList.java:953)
    at java.util.LinkedList$ListItr.next(LinkedList.java:886)
    at org.springframework.core.env.PropertySourcesPropertyResolver.containsProperty(PropertySourcesPropertyResolver.java:49)
    at org.springframework.core.env.AbstractEnvironment.containsProperty(AbstractEnvironment.java:460)
    at org.springframework.cloud.netflix.archaius.ConfigurableEnvironmentConfiguration.containsKey(ConfigurableEnvironmentConfiguration.java:43)
    at com.netflix.config.ConcurrentCompositeConfiguration.getSource(ConcurrentCompositeConfiguration.java:864)
    at com.netflix.config.ConcurrentCompositeConfiguration$1.configurationChanged(ConcurrentCompositeConfiguration.java:151)
    at com.netflix.config.ConcurrentMapConfiguration.fireEvent(ConcurrentMapConfiguration.java:312)
    at com.netflix.config.ConcurrentMapConfiguration.setProperty(ConcurrentMapConfiguration.java:216)
    at com.netflix.config.ConcurrentCompositeConfiguration.setProperty(ConcurrentCompositeConfiguration.java:486)
    at com.netflix.eureka.cluster.PeerEurekaNode.getBatcher(PeerEurekaNode.java:806)
    at com.netflix.eureka.cluster.PeerEurekaNode.<init>(PeerEurekaNode.java:94)
    at com.netflix.eureka.PeerAwareInstanceRegistry.updatePeerEurekaNodes(PeerAwareInstanceRegistry.java:219)
    at com.netflix.eureka.PeerAwareInstanceRegistry.setupPeerEurekaNodes(PeerAwareInstanceRegistry.java:187)
    at com.netflix.eureka.PeerAwareInstanceRegistry.init(PeerAwareInstanceRegistry.java:156)
    at com.netflix.eureka.PeerAwareInstanceRegistry.<init>(PeerAwareInstanceRegistry.java:144)
    at com.netflix.eureka.PeerAwareInstanceRegistry.<clinit>(PeerAwareInstanceRegistry.java:130)
    at org.springframework.cloud.netflix.eureka.server.EurekaServerInitializerConfiguration$RegistryInstanceProxyInitializer.onApplicationEvent(EurekaServerInitializerConfiguration.java:174)
    at org.springframework.cloud.netflix.eureka.server.EurekaServerInitializerConfiguration$RegistryInstanceProxyInitializer.onApplicationEvent(EurekaServerInitializerConfiguration.java:156)
    at org.springframework.cloud.netflix.eureka.server.EurekaServerInitializerConfiguration$RegistryInstanceProxyInitializer$$EnhancerBySpringCGLIB$$e403e8f8.onApplicationEvent(<generated>)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:98)
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:333)
    at org.springframework.cloud.netflix.eureka.server.EurekaServerInitializerConfiguration$1$1.initEurekaEnvironment(EurekaServerInitializerConfiguration.java:109)
    at com.netflix.eureka.EurekaBootStrap.contextInitialized(EurekaBootStrap.java:88)
    at org.springframework.cloud.netflix.eureka.server.EurekaServerInitializerConfiguration$1.run(EurekaServerInitializerConfiguration.java:100)
    at java.lang.Thread.run(Thread.java:744)
Affects: 4.0.7
Reference URL: spring-cloud/spring-cloud-netflix#25
Issue Links:
- ConcurrentModificationException when doing a merge on AbstractEnvironment [SPR-13213] #17805 ConcurrentModificationException when doing a merge on AbstractEnvironment
- Concurrency Exception during bean configuration related to not thread safe getBeanPostProcessor access [SPR-17286] #21819 Concurrency Exception during bean configuration related to not thread safe getBeanPostProcessor access
- Consistent logging in Environment and PropertySource implementations [SPR-15825] #20380 Consistent logging in Environment and PropertySource implementations
Referenced from: commits 2490d1b, 1ef06cc
Backported to: 4.0.9
Metadata
Metadata
Assignees
Labels
status: backportedAn issue that has been backported to maintenance branchesAn issue that has been backported to maintenance branchestype: enhancementA general enhancementA general enhancement