[ 
https://issues.apache.org/jira/browse/KAFKA-8837?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Anna Povzner updated KAFKA-8837:
--------------------------------
    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]

  was:
@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.

We should move `TestUtils.verifyNonDaemonThreadsStatus(this.getClass.getName)` 
to the end of `tearDown()`. However, would also be good to prevent people using 
this method in tear down similarly in the future. Maybe just adding a comment 
would help here.

        Summary: Several integration tests incorrectly use 
verifyNonDaemonThreadsStatus  (was: KafkaMetricReporterClusterIdTest may not 
shutdown ZooKeeperTestHarness)

> Several integration tests incorrectly use verifyNonDaemonThreadsStatus
> ----------------------------------------------------------------------
>
>                 Key: KAFKA-8837
>                 URL: https://issues.apache.org/jira/browse/KAFKA-8837
>             Project: Kafka
>          Issue Type: Bug
>          Components: core
>            Reporter: Anna Povzner
>            Assignee: Anastasia Vela
>            Priority: Major
>
> @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]



--
This message was sent by Atlassian Jira
(v8.3.2#803003)

Reply via email to