ambari-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tom Beerbower" <>
Subject Re: Review Request 36140: ConcurrentModificationException during add host to config group
Date Thu, 02 Jul 2015 21:52:23 GMT

This is an automatically generated e-mail. To reply, visit:

(Updated July 2, 2015, 9:52 p.m.)

Review request for Ambari, Dmytro Sen, John Speidel, and Robert Nettleton.

Bugs: AMBARI-12262

Repository: ambari


1. Provision a cluster with the attached blueprint. Ambari will create 2 config groups for
HDFS and YARN besides the default one.
2. Install the ambari-agent on a new host and let it register to Ambari
3. Add the newly registered host to the cluster (POST /clusters/${getClusterName()}/hosts)
4. Add the components from slave_1 host group to the new host
5. Try to add the new host to both HDFS:slave_1 and YARN:slave_1 host group

Stack trace ...

    javax.persistence.PersistenceException: java.util.ConcurrentModificationException
	at org.eclipse.persistence.internal.jpa.QueryImpl.executeUpdate(
	at org.apache.ambari.server.orm.dao.DaoUtils.executeUpdate(
	at org.apache.ambari.server.orm.dao.ConfigGroupConfigMappingDAO.removeAllByGroup(
	at org.apache.ambari.server.orm.AmbariJpaLocalTxnInterceptor.invoke(
	at org.apache.ambari.server.state.configgroup.ConfigGroupImpl.persistConfigMapping(
    Caused by: java.util.ConcurrentModificationException
	at java.util.IdentityHashMap$IdentityHashMapIterator.nextIndex(
	at java.util.IdentityHashMap$
	at org.eclipse.persistence.internal.sessions.CollectionChangeRecord.mergeRecord(
	at org.eclipse.persistence.internal.sessions.ObjectChangeSet.mergeObjectChanges(
	at org.eclipse.persistence.internal.sessions.UnitOfWorkChangeSet.mergeObjectChanges(
	at org.eclipse.persistence.internal.sessions.UnitOfWorkChangeSet.mergeUnitOfWorkChangeSet(
	at org.eclipse.persistence.internal.sessions.RepeatableWriteUnitOfWork.writeChanges(
	at org.eclipse.persistence.internal.jpa.EntityManagerImpl.flush(
	at org.eclipse.persistence.internal.jpa.QueryImpl.performPreQueryFlush(
	at org.eclipse.persistence.internal.jpa.QueryImpl.executeUpdate(
The ConfigGroupImpl code was doing a merge of the associated config group entity at the begining
of the @Transactional annotated saveIfPersisted() method.  It seems to me that it serves no
purpose, especially since the entity is merged later in the transaction.  

    configGroupEntity = configGroupDAO.merge(configGroupEntity);
Removing that line seems to resolve the issue.  Also did a little refactoring to remove a
findById (to get the associated cluster entity) from the transactional scope.

Also resolved conflict with fix for AMBARI-12063.




Testing (updated)

Manual tested with STR above.  Verified no CME and host successfully added.

mvn clean test

[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 47:22 min
[INFO] Finished at: 2015-07-02T17:44:50-04:00
[INFO] Final Memory: 58M/2036M
[INFO] ------------------------------------------------------------------------


Tom Beerbower

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message