Skip to content

GenericConversionService$Converters.getMatchableConverters throws ConcurrentModificationException on Java 9+ #26183

@HelJani

Description

@HelJani

Affects: spring-boot 2.3.2 and higher

Since this commit 550f13e#diff-00728bf33ef5ae1a833bdd47f5095b4bb377206328c288ad2290e9d89ba0d3d4 we get intermittent ConcurrentModificationException from GenericConversionService$Converters.getMatchableConverters(GenericConversionService.java:522) during start:

ERROR 2020-11-30 18:26:00.296 [AcxSpringBoot-56.starting][c1a00a] - Application run failed [SpringApplication]
java.util.ConcurrentModificationException: null
  at java.base/java.util.HashMap.computeIfAbsent(HashMap.java:1134)
  at org.springframework.core.convert.support.GenericConversionService$Converters.getMatchableConverters(GenericConversionService.java:522)
  at org.springframework.core.convert.support.GenericConversionService$Converters.add(GenericConversionService.java:515)
  at org.springframework.core.convert.support.GenericConversionService.addConverter(GenericConversionService.java:105)
  at org.springframework.core.convert.support.GenericConversionService.addConverter(GenericConversionService.java:99)
  at org.springframework.security.config.crypto.RsaKeyConversionServicePostProcessor.postProcessBeanFactory(RsaKeyConversionServicePostProcessor.java:72)
  at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:291)
  at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:182)
  at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:707)
  at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:533)
  at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143)
  at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758)
  at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750)
  at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
  at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
  at com.wamas.acx4.mfs.core.server.remote.rest.AcxSpringAppForRest.start(AcxSpringAppForRest.java:97)
  at com.wamas.acx4.mfs.core.server.remote.rest.AcxSpringDaemon.onStart(AcxSpringDaemon.java:57)
  at com.wamas.acx4.mfs.core.etc.executor.AcxRunnable.lambda$onStartInternal$2(AcxRunnable.java:318)
  at com.wamas.acx4.mfs.core.decorator.internal.InternalDecorateWith.execWithNewContextAndTransaction(InternalDecorateWith.java:183)
  at com.wamas.acx4.mfs.core.decorator.Decorate.exec(Decorate.java:840)
  at com.wamas.acx4.mfs.core.etc.executor.AcxRunnable.onStartInternal(AcxRunnable.java:318)
  at com.wamas.acx4.mfs.core.server.platform.daemon.ServiceDaemon.onStartInternal(ServiceDaemon.java:96)
  at com.wamas.acx4.mfs.core.etc.executor.AcxRunnable.run(AcxRunnable.java:181)
  at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
  at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
  at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
  at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
  at java.base/java.lang.Thread.run(Thread.java:834)

Since Java 9 java.util.HashMap.computeIfAbsent shows this behavior.
See https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/HashMap.html#computeIfAbsent(K,java.util.function.Function)

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)status: backportedAn issue that has been backported to maintenance branchestype: regressionA bug that is also a regression

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions