Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-4195

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.18.0
    • 0.19.0
    • io
    • None
    • Reviewed

    Description

      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.

      SequenceFile.java
          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;
            }
          }
      

      Attachments

        1. HADOOP-4195_0_20080917.patch
          0.8 kB
          Arun Murthy

        Issue Links

          Activity

            People

              acmurthy Arun Murthy
              hong.tang Hong Tang
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: