]
Hielke Hoeve updated WFLY-13162:
--------------------------------
Affects Version/s: 20.0.0.Beta1
ConcurrentModificationException in WildFlyJobXmlResolver
--------------------------------------------------------
Key: WFLY-13162
URL:
https://issues.redhat.com/browse/WFLY-13162
Project: WildFly
Issue Type: Bug
Components: Batch
Affects Versions: 18.0.1.Final, 19.0.0.Beta3, 20.0.0.Beta1
Reporter: Hielke Hoeve
Assignee: Cheng Fang
Priority: Major
Because of a thread unsafe construction in WildFlyJobXmlResolver I am experiencing
ConcurrentModificationExceptions while starting my EAR every so often. This is because
every EJB of the EAR is processed by WildFlyJobXmlResolver in paralel threads. Even if it
has no jbatch dependency or dependency to a EJB which does.
This is not reproducable for every startup as it depends on the performance of the host
machine, number of ejbs in ear, number of threads and thread timing.
I have created an example project representing our project setup with which I am able to
reproduce the issue using a default wildfly build. This test project contains 1 EJB with
jbatch, a number of plain EJBs, a WAR which uses the jbatch EJB and an EAR.
See below for the exception stacktrace.
I have made a small fix for this issue @
https://github.com/hielkehoeve/wildfly/commit/82047233621c3e5bdbd45333ca4....
The example test project can also be found there.
{code:java}
08:32:30,164 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC000001:
Failed to start service
jboss.deployment.subunit."project.ear"."project-d.jar".POST_MODULE:
org.jboss.msc.service.StartException in service
jboss.deployment.subunit."project.ear"."project-d.jar".POST_MODULE:
WFLYSRV0153: Failed to process phase POST_MODULE of subdeployment
"project-d.jar" of deployment "project.ear"
at
org.jboss.as.server@10.0.0.Final//org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:183)
at
org.jboss.msc@1.4.11.Final//org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1739)
at
org.jboss.msc@1.4.11.Final//org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(ServiceControllerImpl.java:1701)
at
org.jboss.msc@1.4.11.Final//org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(ServiceControllerImpl.java:1559)
at
org.jboss.threads@2.3.3.Final//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at
org.jboss.threads@2.3.3.Final//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1982)
at
org.jboss.threads@2.3.3.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
at
org.jboss.threads@2.3.3.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1363)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.util.ConcurrentModificationException
at
java.base/java.util.LinkedHashMap$LinkedHashIterator.nextNode(LinkedHashMap.java:719)
at java.base/java.util.LinkedHashMap$LinkedKeyIterator.next(LinkedHashMap.java:741)
at java.base/java.util.AbstractCollection.addAll(AbstractCollection.java:351)
at
org.wildfly.extension.batch.jberet@18.0.0.Final//org.wildfly.extension.batch.jberet.deployment.WildFlyJobXmlResolver.merge(WildFlyJobXmlResolver.java:261)
at
org.wildfly.extension.batch.jberet@18.0.0.Final//org.wildfly.extension.batch.jberet.deployment.WildFlyJobXmlResolver.forDeployment(WildFlyJobXmlResolver.java:127)
at
org.wildfly.extension.batch.jberet@18.0.0.Final//org.wildfly.extension.batch.jberet.deployment.WildFlyJobXmlResolver.forDeployment(WildFlyJobXmlResolver.java:130)
at
org.wildfly.extension.batch.jberet@18.0.0.Final//org.wildfly.extension.batch.jberet.deployment.WildFlyJobXmlResolver.forDeployment(WildFlyJobXmlResolver.java:130)
at
org.wildfly.extension.batch.jberet@18.0.0.Final//org.wildfly.extension.batch.jberet.deployment.WildFlyJobXmlResolver.forDeployment(WildFlyJobXmlResolver.java:130)
at
org.wildfly.extension.batch.jberet@18.0.0.Final//org.wildfly.extension.batch.jberet.deployment.WildFlyJobXmlResolver.forDeployment(WildFlyJobXmlResolver.java:130)
at
org.wildfly.extension.batch.jberet@18.0.0.Final//org.wildfly.extension.batch.jberet.deployment.BatchEnvironmentProcessor.deploy(BatchEnvironmentProcessor.java:78)
at
org.jboss.as.server@10.0.0.Final//org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:176)
... 8 more
{code}