zeekling commented on code in PR #7828:
URL: https://github.com/apache/hadoop/pull/7828#discussion_r2233965863
##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/nodelabels/NodeAttributesManagerImpl.java:
##########
@@ -741,7 +741,15 @@ public void refreshNodeAttributesToScheduler(NodeId
nodeId) {
if (host == null || host.attributes == null) {
return;
}
- newNodeToAttributesMap.put(hostName, host.attributes.keySet());
+
+ // Use read lock and create defensive copy since
+ // other threads might access host.attributes
+ readLock.lock();
+ try {
+ newNodeToAttributesMap.put(hostName, new
HashSet<>(host.attributes.keySet()));
Review Comment:
Judging from the stack, the problem occurred when the log was printed, and
the wrong line was modified.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]