hadoop-common-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "robert Cook (JIRA)" <j...@apache.org>
Subject [jira] Created: (HADOOP-6512) Complex Writable classes are not thread safe
Date Tue, 26 Jan 2010 20:26:34 GMT
Complex Writable classes are not thread safe
--------------------------------------------

                 Key: HADOOP-6512
                 URL: https://issues.apache.org/jira/browse/HADOOP-6512
             Project: Hadoop Common
          Issue Type: Bug
          Components: io
    Affects Versions: 0.20.1
         Environment: hadoop 20.1, java 1.6.0_17, fedora
            Reporter: robert Cook


While SequenceFile methods are properly "synchronized", the complex Writable classes are not
thread safe.

e.g. ArrayWritable, interleaved in... calls by different threads will scramble input

  public void readFields(DataInput in) throws IOException {
    values = new Writable[in.readInt()];          // construct values
    for (int i = 0; i < values.length; i++) {
      Writable value = WritableFactories.newInstance(valueClass);
      value.readFields(in);                       // read a value
      values[i] = value;                          // store it in values
    }
  }

Please add synchronized prefixes.  Not needed for simple types.

-- 
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