You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by cu...@apache.org on 2006/06/22 21:38:39 UTC
svn commit: r416451 - in /lucene/hadoop/trunk: CHANGES.txt
src/java/org/apache/hadoop/mapred/JobTracker.java
Author: cutting
Date: Thu Jun 22 12:38:38 2006
New Revision: 416451
URL: http://svn.apache.org/viewvc?rev=416451&view=rev
Log:
HADOOP-316. Fix a potential deadlock in the jobtracker. Contributed by Owen.
Modified:
lucene/hadoop/trunk/CHANGES.txt
lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobTracker.java
Modified: lucene/hadoop/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/CHANGES.txt?rev=416451&r1=416450&r2=416451&view=diff
==============================================================================
--- lucene/hadoop/trunk/CHANGES.txt (original)
+++ lucene/hadoop/trunk/CHANGES.txt Thu Jun 22 12:38:38 2006
@@ -38,6 +38,9 @@
"reduce" (generating output). Long-term, the "sort" phase will
also be removed. (omalley via cutting)
+ 9. HADOOP-316. Fix a potential deadlock in the jobtracker.
+ (omalley via cutting)
+
Release 0.3.2 - 2006-06-09
Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobTracker.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobTracker.java?rev=416451&r1=416450&r2=416451&view=diff
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobTracker.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/JobTracker.java Thu Jun 22 12:38:38 2006
@@ -113,32 +113,32 @@
Thread.sleep(TASKTRACKER_EXPIRY_INTERVAL/3);
long now = System.currentTimeMillis();
LOG.debug("Starting launching task sweep");
- synchronized (launchingTasks) {
- Iterator itr = launchingTasks.entrySet().iterator();
- while (itr.hasNext()) {
- Map.Entry pair = (Map.Entry) itr.next();
- String taskId = (String) pair.getKey();
- long age = now - ((Long) pair.getValue()).longValue();
- LOG.info(taskId + " is " + age + " ms debug.");
- if (age > TASKTRACKER_EXPIRY_INTERVAL) {
- LOG.info("Launching task " + taskId + " timed out.");
- TaskInProgress tip = null;
- synchronized (JobTracker.this) {
+ synchronized (JobTracker.this) {
+ synchronized (launchingTasks) {
+ Iterator itr = launchingTasks.entrySet().iterator();
+ while (itr.hasNext()) {
+ Map.Entry pair = (Map.Entry) itr.next();
+ String taskId = (String) pair.getKey();
+ long age = now - ((Long) pair.getValue()).longValue();
+ LOG.info(taskId + " is " + age + " ms debug.");
+ if (age > TASKTRACKER_EXPIRY_INTERVAL) {
+ LOG.info("Launching task " + taskId + " timed out.");
+ TaskInProgress tip = null;
tip = (TaskInProgress) taskidToTIPMap.get(taskId);
+ if (tip != null) {
+ JobInProgress job = tip.getJob();
+ String trackerName = getAssignedTracker(taskId);
+ TaskTrackerStatus trackerStatus =
+ getTaskTracker(trackerName);
+ job.failedTask(tip, taskId, "Error launching task",
+ trackerStatus.getHost(), trackerName);
+ }
+ itr.remove();
+ } else {
+ // the tasks are sorted by start time, so once we find
+ // one that we want to keep, we are done for this cycle.
+ break;
}
- if (tip != null) {
- JobInProgress job = tip.getJob();
- String trackerName = getAssignedTracker(taskId);
- TaskTrackerStatus trackerStatus =
- getTaskTracker(trackerName);
- job.failedTask(tip, taskId, "Error launching task",
- trackerStatus.getHost(), trackerName);
- }
- itr.remove();
- } else {
- // the tasks are sorted by start time, so once we find
- // one that we want to keep, we are done for this cycle.
- break;
}
}
}