divijvaidya commented on PR #18678: URL: https://github.com/apache/kafka/pull/18678#issuecomment-2612842354
Great question @clolov! In other test suites, we use `TestUtils.assertNoNonDaemonThreads`. @gharris1727 has done some excellent work for client leaks at https://github.com/apache/kafka/pull/14783 which hasn't been merged yet and we have a pending JIRA to catch thread leaks for all tests https://issues.apache.org/jira/browse/KAFKA-16072 For this specific test, @pramithas if we add the following lines, we are able to detect leaks in two tests: ``` @AfterEach public void detectLeaks() { List<Thread> nonDaemonThreads = Thread.getAllStackTraces().keySet().stream() .filter(t -> !t.isDaemon() && t.isAlive() && t.getName().startsWith(this.getClass().getName())) .collect(Collectors.toList()); int threadCount = nonDaemonThreads.size(); assertEquals(0, threadCount); } ``` Let's start with adding this leak detection here in the short term and then perhaps @pramithas , if you are interested, you may want to pick up https://issues.apache.org/jira/browse/KAFKA-16072 ? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org