[ https://issues.apache.org/jira/browse/GOBBLIN-1211?focusedWorklogId=458401&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-458401 ]
ASF GitHub Bot logged work on GOBBLIN-1211: ------------------------------------------- Author: ASF GitHub Bot Created on: 14/Jul/20 00:54 Start Date: 14/Jul/20 00:54 Worklog Time Spent: 10m Work Description: autumnust commented on a change in pull request #3059: URL: https://github.com/apache/incubator-gobblin/pull/3059#discussion_r454033430 ########## File path: gobblin-yarn/src/main/java/org/apache/gobblin/yarn/YarnService.java ########## @@ -766,13 +767,21 @@ public void onContainersAllocated(List<Container> containers) { //Iterate over the (thread-safe) set of unused instances to find the first instance that is not currently live. //Once we find a candidate instance, it is removed from the set. String instanceName = null; - Iterator<String> iterator = unusedHelixInstanceNames.iterator(); - while (iterator.hasNext()) { - instanceName = iterator.next(); - if (!HelixUtils.isInstanceLive(helixManager, instanceName)) { - iterator.remove(); - LOGGER.info("Found an unused instance {}", instanceName); - break; + + //Ensure that updates to unusedHelixInstanceNames are visible to other threads that might concurrently + //invoke the callback on container allocation. + synchronized (lock) { Review comment: Why using explicit lock instead of intrinsic lock here? ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 458401) Time Spent: 0.5h (was: 20m) > Track unused Helix instances in a thread-safe manner > ---------------------------------------------------- > > Key: GOBBLIN-1211 > URL: https://issues.apache.org/jira/browse/GOBBLIN-1211 > Project: Apache Gobblin > Issue Type: Improvement > Components: gobblin-yarn > Affects Versions: 0.15.0 > Reporter: Sudarshan Vasudevan > Assignee: Abhishek Tiwari > Priority: Major > Fix For: 0.15.0 > > Time Spent: 0.5h > Remaining Estimate: 0h > > The AMRMClient processes container allocation events asynchronously in a > separate thread. If there are multiple concurrent container requests and > consequent callbacks, we need to ensure that updates to shared data > structures such as the set of unused Helix instance names are consistent and > thread-safe. In other words, any updates to this set made by one thread will > be visible to all other threads handling the container allocation events. -- This message was sent by Atlassian Jira (v8.3.4#803005)