Skip to content

Commit 441d7df

Browse files
committed
YARN-11838: YARN ConcurrentModificationException When Refreshing Node Attributes
1 parent bc5a5b8 commit 441d7df

File tree

2 files changed

+9
-2
lines changed
  • hadoop-common-project/hadoop-common/src/main/conf
  • hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/nodelabels

2 files changed

+9
-2
lines changed

hadoop-common-project/hadoop-common/src/main/conf/core-site.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="UTF-8"?>
1+
x<?xml version="1.0" encoding="UTF-8"?>
22
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
33
<!--
44
Licensed under the Apache License, Version 2.0 (the "License");

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/nodelabels/NodeAttributesManagerImpl.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,14 @@ public void refreshNodeAttributesToScheduler(NodeId nodeId) {
745745

746746
// Notify RM
747747
if (rmContext != null && rmContext.getDispatcher() != null) {
748-
LOG.info("Updated NodeAttribute event to RM:" + newNodeToAttributesMap);
748+
// iterating newNodeToAttributesMap will access host.attributes
749+
// which might be modified by other threads.
750+
readLock.lock();
751+
try {
752+
LOG.info("Updated NodeAttribute event to RM:" + newNodeToAttributesMap);
753+
} finally {
754+
readLock.unlock();
755+
}
749756
rmContext.getDispatcher().getEventHandler().handle(
750757
new NodeAttributesUpdateSchedulerEvent(newNodeToAttributesMap));
751758
}

0 commit comments

Comments
 (0)