Uploaded image for project: 'Hue (READ ONLY)'
  1. Hue (READ ONLY)
  2. HUE-2183

Filebrowser read file does not pass correct file length to httpfs

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Works for Me
    • Affects Version/s: 3.6.0
    • Fix Version/s: None
    • Component/s: app.filebrowser
    • Labels:
      None

      Description

      sample file
      /user/mapr/blah.txt
      has contents "test httpfs"

      httpfs-audit.log prints the following when hue filebrowser tries to open that file-

      2014-06-18 14:02:27,743 INFO [][mapr:] OPEN [/user/mapr/blah.txt] offset [0] len [-1]

      Notice that the length is wrongly set to -1. This causes httpfs to enter the wrong loop here -
      https://github.com/cloudera/httpfs/blob/cdh3u6/src/main/java/org/apache/hadoop/lib/wsrs/InputStreamEntity.java#L47

      causing httpfs to call the wrong overloaded method IOUtils.copyBytes with int as the 3rd argument. This leads to the whole input stream being copied to the output stream instead of only the bufSize being copied from input stream to output stream.

      http://hadoop.apache.org/docs/r2.3.0/api/org/apache/hadoop/io/IOUtils.html#copyBytes(java.io.InputStream, java.io.OutputStream, int, boolean)

      With the attached patch, this has been corrected and httpfs-audit.log prints the following -
      2014-06-18 14:36:46,796 INFO [][mapr:] OPEN [/user/mapr/blah.txt] offset [0] len [3]

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              suhassatish Suhas Satish
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: