hadoop-common-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aaron Greenhouse (JIRA)" <j...@apache.org>
Subject [jira] Created: (HADOOP-3553) Nested class TaskTracker.TaskInProgress needs additional synchronization
Date Fri, 13 Jun 2008 14:16:45 GMT
Nested class TaskTracker.TaskInProgress needs additional synchronization
------------------------------------------------------------------------

                 Key: HADOOP-3553
                 URL: https://issues.apache.org/jira/browse/HADOOP-3553
             Project: Hadoop Core
          Issue Type: Bug
          Components: mapred
    Affects Versions: 0.17.0
         Environment: All Java platforms
            Reporter: Aaron Greenhouse


The nested class TaskTracker.TaskInProgress needs additional synchronization to work properly
with the Java Memory Model.  Presumably this class is accessed by more than one thread, because
it already contains synchronization.  However, it needs additional synchronization, especially
to protect access to the long fields lastProgressReport and taskTimeOut.  Long fields are
not guaranteed to be read/written atomically, so not only do you risk reading stale values,
but you risk reading corrupted values.

The field wasKilled also needs synchronization, as it is polled from within the TaskTracker
class.  

I suggest the following improvements to the class
- Make the fields task and taskStatus final.  They are used this way already.  Making them
final clarifies there behavior in a current environment.
- Add the synchronized modifier to the methods getLastProgressReport() and getTaskTimeout().
- Make the field wasKilled private and add a new public synchronized wasKilled() getter method.
 Replace the use of the field with this method in TaskTracker.
- Add a comment to localizeTask() indicating that the caller must be synchronized on this.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message