Skip to content

SpringIterableConfigurationPropertySource fails when underlying source throws ConcurrentModificationException #17013

@ddcruver

Description

@ddcruver

We have not been able to reproduce it reliably but we have notice instances of Spring Boot not initializing correctly and each time throwing a java.Util.ConcurrentModificationException exception when trying to bind properties for the Spring Application.

This seems to happen in a AWS instance were the I/O and CPU is more restrained and does not happen as much when we deploy to larger instances. There is no documented case of this happening in our local development environments.

Caused by: java.util.ConcurrentModificationException
    at java.util.Hashtable$Enumerator.next(Hashtable.java:1387) [rt.jar:1.8.0_212]
    at java.util.AbstractCollection.addAll(AbstractCollection.java:343) [rt.jar:1.8.0_212]
    at java.util.HashSet.<init>(HashSet.java:120) [rt.jar:1.8.0_212]
    at org.springframework.boot.context.properties.source.SpringIterableConfigurationPropertySource$CacheKey.copyKey(SpringIterableConfigurationPropertySource.java:189)
    at org.springframework.boot.context.properties.source.SpringIterableConfigurationPropertySource$CacheKey.copy(SpringIterableConfigurationPropertySource.java:184)
    at org.springframework.boot.context.properties.source.SpringIterableConfigurationPropertySource.getCache(SpringIterableConfigurationPropertySource.java:142)
    at org.springframework.boot.context.properties.source.SpringIterableConfigurationPropertySource.getConfigurationPropertyNames(SpringIterableConfigurationPropertySource.java:97)
    at org.springframework.boot.context.properties.source.SpringIterableConfigurationPropertySource.iterator(SpringIterableConfigurationPropertySource.java:87)
    at org.springframework.boot.context.properties.source.ConfigurationPropertyState.search(ConfigurationPropertyState.java:62)
    at org.springframework.boot.context.properties.source.SpringIterableConfigurationPropertySource.containsDescendantOf(SpringIterableConfigurationPropertySource.java:93)
    at org.springframework.boot.context.properties.bind.Binder.containsNoDescendantOf(Binder.java:367)
    at org.springframework.boot.context.properties.bind.Binder.bindObject(Binder.java:256)
    at org.springframework.boot.context.properties.bind.Binder.bind(Binder.java:220)
    ... 65 more

I will attach more complete stack traces to it being called from different points in the initialization of our application.

concurrent-modification-instance-1.txt
concurrent-modification-instance-2.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    for: external-projectFor an external project and not something we can fix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions