diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt index 18863a1a4a..0839a1486f 100644 --- a/hadoop-mapreduce-project/CHANGES.txt +++ b/hadoop-mapreduce-project/CHANGES.txt @@ -749,6 +749,9 @@ Release 0.23.3 - UNRELEASED maximum-am-resource-percent configurable on a per queue basis (tgraves via bobby) + MAPREDUCE-4467. IndexCache failures due to missing synchronization + (Kihwal Lee via tgraves) + Release 0.23.2 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/IndexCache.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/IndexCache.java index 2dbdf11960..54add3a81a 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/IndexCache.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/IndexCache.java @@ -67,13 +67,13 @@ class IndexCache { if (info == null) { info = readIndexFileToCache(fileName, mapId, expectedIndexOwner); } else { - while (isUnderConstruction(info)) { - try { - // In case the entry is ready after the above check but - // before the following wait, we do timed wait. - info.wait(200); - } catch (InterruptedException e) { - throw new IOException("Interrupted waiting for construction", e); + synchronized(info) { + while (isUnderConstruction(info)) { + try { + info.wait(); + } catch (InterruptedException e) { + throw new IOException("Interrupted waiting for construction", e); + } } } LOG.debug("IndexCache HIT: MapId " + mapId + " found"); @@ -101,13 +101,13 @@ class IndexCache { IndexInformation info; IndexInformation newInd = new IndexInformation(); if ((info = cache.putIfAbsent(mapId, newInd)) != null) { - while (isUnderConstruction(info)) { - try { - // In case the entry is ready after the above check but - // before the following wait, we do timed wait. - info.wait(200); - } catch (InterruptedException e) { - throw new IOException("Interrupted waiting for construction", e); + synchronized(info) { + while (isUnderConstruction(info)) { + try { + info.wait(); + } catch (InterruptedException e) { + throw new IOException("Interrupted waiting for construction", e); + } } } LOG.debug("IndexCache HIT: MapId " + mapId + " found");