Uploaded image for project: 'Apache Cassandra'
  1. Apache Cassandra
  2. CASSANDRA-14922

In JVM dtests need to clean up after instance shutdown

    XMLWordPrintableJSON

Details

    • Low

    Description

      Currently the unit tests are failing on circleci (example one, example two) because we use a small container (medium) for unit tests by default and the in JVM dtests are leaking a few hundred megabytes of memory per test right now. This is not a big deal because the dtest runs with the larger containers continue to function fine as well as local testing as the number of in JVM dtests is not yet high enough to cause a problem with more than 2GB of available heap. However we should fix the memory leak so that going forwards we can add more in JVM dtests without worry.

      I've been working with ifesdjeen to debug, and the issue appears to be unreleased Table/Keyspace metrics (screenshot showing the leak attached). I believe that we have a few potential issues that are leading to the leaks:

      1. The Instance::shutdown method is not successfully cleaning up all the metrics created by the CassandraMetricsRegistry
      2. The TestCluster::close method is not waiting for all the instances to finish shutting down and cleaning up before continuing on
      3. I'm not sure if this is an issue assuming we clear all metrics, but TableMetrics::release does not release all the metric references (which could leak them)

      I am working on a patch which shuts down everything and assures that we do not leak memory.

      Attachments

        1. Screen Shot 2019-01-30 at 15.47.13.png
          187 kB
          Alex Petrov
        2. Screen Shot 2019-01-30 at 15.46.35.png
          190 kB
          Alex Petrov
        3. OnlyThreeRootsLeft.png
          374 kB
          Joey Lynch
        4. no_more_references.png
          223 kB
          Joey Lynch
        5. Metaspace_Actually_Collected.png
          110 kB
          Joey Lynch
        6. MemoryReclaimedFix.png
          104 kB
          Joey Lynch
        7. MainClassRetaining.png
          381 kB
          Joey Lynch
        8. Leaking_Metrics_On_Shutdown.png
          189 kB
          Joey Lynch
        9. LeakedNativeMemory.png
          330 kB
          Joey Lynch
        10. ClassLoadersRetaining.png
          178 kB
          Joey Lynch
        11. AllThreadsStopped.png
          342 kB
          Joey Lynch

        Issue Links

          Activity

            People

              jolynch Joey Lynch
              jolynch Joey Lynch
              Joey Lynch
              Alex Petrov
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: