SequenceFile.Writer close() uses compressor after returning it to CodecPool.
----------------------------------------------------------------------------

                 Key: HADOOP-4195
                 URL: https://issues.apache.org/jira/browse/HADOOP-4195
             Project: Hadoop Core
          Issue Type: Bug
          Components: io
    Affects Versions: 0.18.0
            Reporter: Hong Tang


In function SequenceFile.Writer.close() (line 946): The first marked line 
returns the compressor while the second marked line will use the compressor 
again. This will lead to a race condition if another thread checks out the 
compressor between these two marked statements.

{code:title=SequenceFile.java|borderStyle=solid}
    public synchronized void close() throws IOException {
      CodecPool.returnCompressor(compressor); // <==== compressor returned
      
      keySerializer.close();
      uncompressedValSerializer.close();
      if (compressedValSerializer != null) {
        compressedValSerializer.close(); // <===== compressor used
      }

      if (out != null) {
        
        // Close the underlying stream iff we own it...
        if (ownOutputStream) {
          out.close();
        } else {
          out.flush();
        }
        out = null;
      }
    }
{code} 


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

Reply via email to