Uploaded image for project: 'Hadoop HDFS'
  1. Hadoop HDFS
  2. HDFS-596

Memory leak in libhdfs: hdfsFreeFileInfo() in libhdfs does not free memory for mOwner and mGroup

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • 0.20.1
    • 0.20.2, 0.21.0
    • fuse-dfs
    • None
    • Linux hadoop-001 2.6.28-14-server #47-Ubuntu SMP Sat Jul 25 01:18:34 UTC 2009 i686 GNU/Linux. Namenode with 1GB memory.

    • Reviewed
    • Memory leak in function hdfsFreeFileInfo in libhdfs. This bug affects fuse-dfs severely.
    • memory leak libhdfs hdfsFreeFileInfo fuse-dfs

    Description

      This bugs affects fuse-dfs severely. In my test, about 1GB memory were exhausted and the fuse-dfs mount directory was disconnected after writing 14000 files. This bug is related to the memory leak problem of this issue: http://issues.apache.org/jira/browse/HDFS-420.

      The bug can be fixed very easily. In function hdfsFreeFileInfo() in file hdfs.c (under c++/libhdfs/) change code block:

      //Free the mName
      int i;
      for (i=0; i < numEntries; ++i) {
      if (hdfsFileInfo[i].mName)

      { free(hdfsFileInfo[i].mName); }
      }

      into:

      // free mName, mOwner and mGroup
      int i;
      for (i=0; i < numEntries; ++i) {
      if (hdfsFileInfo[i].mName) { free(hdfsFileInfo[i].mName); }

      if (hdfsFileInfo[i].mOwner)

      { free(hdfsFileInfo[i].mOwner); }

      if (hdfsFileInfo[i].mGroup)

      { free(hdfsFileInfo[i].mGroup); }

      }

      I am new to Jira and haven't figured out a way to generate .patch file yet. Could anyone help me do that so that others can commit the changes into the code base. Thanks!

      Attachments

        1. HDFS-596.patch
          0.7 kB
          Zhang Bingjun

        Issue Links

          Activity

            People

              eddymier Zhang Bingjun
              eddymier Zhang Bingjun
              Votes:
              1 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 0.5h
                  0.5h
                  Remaining:
                  Remaining Estimate - 0.5h
                  0.5h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified