Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConcurrentModificationException when doing a merge on AbstractEnvironment [SPR-13213] #17805

spring-projects-issues opened this issue Jul 8, 2015 · 1 comment
status: backported type: bug


Copy link

@spring-projects-issues spring-projects-issues commented Jul 8, 2015

Stephen Liang opened SPR-13213 and commented

I seem to get an occasional ConcurrentModificationException when doing a merge on various different threads. Perhaps merge() needs to be synchronized?

Caused by: java.util.ConcurrentModificationException
        at java.util.LinkedHashMap$LinkedHashIterator.nextEntry(
        at java.util.LinkedHashMap$
        at java.util.AbstractCollection.toArray(
        at org.springframework.util.StringUtils.toStringArray(
        at org.springframework.core.env.AbstractEnvironment.getDefaultProfiles(
        at org.springframework.core.env.AbstractEnvironment.merge(
        at org.springframework.webflow.engine.builder.model.FlowModelFlowBuilder.createFlowApplicationContext(
        at org.springframework.webflow.engine.builder.model.FlowModelFlowBuilder.initLocalFlowContext(
        at org.springframework.webflow.engine.builder.model.FlowModelFlowBuilder.doInit(
        at org.springframework.webflow.engine.builder.FlowAssembler.assembleFlow(
        at org.springframework.webflow.engine.builder.DefaultFlowHolder.assembleFlow(
        at org.springframework.webflow.engine.builder.DefaultFlowHolder.getFlowDefinition(
        at org.springframework.webflow.definition.registry.FlowDefinitionRegistryImpl.getFlowDefinition(
        at org.springframework.webflow.executor.FlowExecutorImpl.launchExecution(
        at org.springframework.webflow.mvc.servlet.FlowHandlerAdapter.handle(
        at org.springframework.webflow.mvc.servlet.FlowController.handleRequest(
        at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(
        at org.springframework.web.servlet.DispatcherServlet.doDispatch(
        at org.springframework.web.servlet.DispatcherServlet.doService(
        at org.springframework.web.servlet.FrameworkServlet.processRequest(
        ... 227 more

Affects: 3.2.8

Issue Links:

  • #17034 Concurrent registration/iteration in PropertySourcesPropertyResolver
  • #20380 Consistent logging in Environment and PropertySource implementations

Referenced from: commits d2447ce, e393c7b, af5f4e6

Backported to: 4.1.8, 3.2.15

Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Sep 7, 2015

Juergen Hoeller commented

It looks like this may be caused by AbstractEnvironment's lazy resolution of the "spring.profiles.default" property... since for that reason, a call to doGetActiveProfiles may actually lead to a manipulation of the activeProfiles Set, which may in turn break a concurrent attempt to turn it into a String array in getDefaultProfiles. We'll make this more defensive for 4.2.2, backporting the fix to 4.1.8 if it is straightforward enough.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
status: backported type: bug
None yet

No branches or pull requests

2 participants