Cassandra
  1. Cassandra
  2. CASSANDRA-6047

Memory leak when using snapshot repairs

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Fix Version/s: 1.2.10, 2.0.1
    • Component/s: Core
    • Labels:
      None

      Description

      Running nodetool repair repeatedly with the -snapshot parameter results in a native memory leak. The JVM process will take up more and more physical memory until it is killed by the Linux OOM killer.

      The command used was as follows:

      nodetool repair keyspace -local -snapshot -pr -st start_token -et end_token

      Removing the -snapshot flag prevented the memory leak. The subrange repair necessitated multiple repairs, so it made the problem noticeable, but I believe the problem would be reproducible even if you ran repair repeatedly without specifying a start and end token.

      Notes from Yuki Morishita:

      Probably the cause is too many snapshots. Snapshot sstables are opened during validation, but memories used are freed when releaseReferences called. But since snapshots never get marked compacted, memories never freed.

      We only cleanup mmap'd memories when sstable is mark compacted. https://github.com/apache/cassandra/blob/cassandra-1.2/src/java/org/apache/cassandra/io/sstable/SSTableReader.java#L974

      Validation compaction never marks snapshots compacted.

      1. 6047-1.2.txt
        4 kB
        Yuki Morishita

        Activity

        J.B. Langston created issue -
        Jonathan Ellis made changes -
        Field Original Value New Value
        Assignee Yuki Morishita [ yukim ]
        Fix Version/s 1.2.10 [ 12324948 ]
        Priority Major [ 3 ] Minor [ 4 ]
        Component/s Core [ 12312978 ]
        Reviewer jbellis
        Hide
        Yuki Morishita added a comment -

        Patch attached to let SSTableReader implement Closeable and do clean up at #close. Validation compaction against snapshot calls #close at the end of validation.

        Show
        Yuki Morishita added a comment - Patch attached to let SSTableReader implement Closeable and do clean up at #close. Validation compaction against snapshot calls #close at the end of validation.
        Yuki Morishita made changes -
        Attachment 6047-1.2.txt [ 12603851 ]
        Yuki Morishita made changes -
        Status Open [ 1 ] Patch Available [ 10002 ]
        Hide
        Jonathan Ellis added a comment -

        +1

        Show
        Jonathan Ellis added a comment - +1
        Hide
        Yuki Morishita added a comment -

        Committed.

        Show
        Yuki Morishita added a comment - Committed.
        Yuki Morishita made changes -
        Fix Version/s 2.0.1 [ 12324542 ]
        Resolution Fixed [ 1 ]
        Status Patch Available [ 10002 ] Resolved [ 5 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Patch Available Patch Available
        18h 17m 1 Yuki Morishita 18/Sep/13 17:05
        Patch Available Patch Available Resolved Resolved
        3h 21m 1 Yuki Morishita 18/Sep/13 20:27

          People

          • Assignee:
            Yuki Morishita
            Reporter:
            J.B. Langston
            Reviewer:
            Jonathan Ellis
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development