Uploaded image for project: 'Kafka'
  1. Kafka
  2. KAFKA-8837

Several integration tests incorrectly use verifyNonDaemonThreadsStatus

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 2.4.0
    • core
    • None

    Description

      @After method in KafkaMetricReporterClusterIdTest calls  `TestUtils.verifyNonDaemonThreadsStatus(this.getClass.getName)` before it calls tearDown on ZooKeeperTestHarness (which shut downs ZK and zk client). If verifyNonDaemonThreadsStatus asserts, the rest of the resources will not get cleaned up.

      Second, this and several other tests do not actually create KafkaServer with the thread prefix, so this verification does not actually do anything (because threads are not prefixed with the test name). 

      We should move `TestUtils.verifyNonDaemonThreadsStatus(this.getClass.getName)` to the end of `tearDown()`; and every test that calls verifyNonDaemonThreadsStatus should actually create KafkaServer with their test classname prefix. 

      The reason I started looking into this is because one of the recent builds failed with many tests failing with "found unexpected threads...". So, fixing the above may at least help us to find the root cause, because this will increase the chance that a test failing with this error is the same test that leaks the thread. https://builds.apache.org/job/kafka-trunk-jdk11/774/#showFailuresLink

      Attachments

        Issue Links

          Activity

            People

              anastasiavela Anastasia Vela
              apovzner Anna Povzner
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: