ZooKeeper
  1. ZooKeeper
  2. ZOOKEEPER-1189

For an invalid snapshot file(less than 10bytes size) RandomAccessFile stream is leaking.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.3.3
    • Fix Version/s: 3.3.4, 3.4.0, 3.5.0
    • Component/s: server
    • Labels:
      None
    • Hadoop Flags:
      Incompatible change, Reviewed

      Description

      When loading the snapshot, ZooKeeper will consider only the 'snapshots with atleast 10 bytes size'. Otherwsie it will ignore and just return without closing the RandomAccessFile.

      Util.isValidSnapshot() having the following logic. 
             // Check for a valid snapshot
              RandomAccessFile raf = new RandomAccessFile(f, "r");
              // including the header and the last / bytes
              // the snapshot should be atleast 10 bytes
              if (raf.length() < 10) {
                  return false;
              }
      

      Since the snapshot file validation logic is outside try block, it won't go to the finally block and will be leaked.

      Suggestion: Move the validation logic to the try/catch block.

      1. ZOOKEEPER-1189.1.patch
        2 kB
        Rakesh R
      2. ZOOKEEPER-1189.patch
        2 kB
        Rakesh R
      3. ZOOKEEPER-1189-branch-3.3.patch
        2 kB
        Rakesh R

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            Rakesh R
            Reporter:
            Rakesh R
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development