[ https://issues.apache.org/jira/browse/KAFKA-17189?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17868117#comment-17868117 ]
Greg Harris commented on KAFKA-17189: ------------------------------------- [https://docs.oracle.com/javase/7/docs/api/java/lang/Thread.html#getAllStackTraces()] already has a liveness check, so evaluating Thread#isAlive afterwards is prone to race conditions. If the thread is alive at the time of getAllStackTraces, then it's leaked even if it stops executing a moment later. > Add Thread::isAlive to DetectThreadLeak#of filter > ------------------------------------------------- > > Key: KAFKA-17189 > URL: https://issues.apache.org/jira/browse/KAFKA-17189 > Project: Kafka > Issue Type: Sub-task > Reporter: PoAn Yang > Assignee: PoAn Yang > Priority: Minor > > Although we have KAFKA-17159 to close kafka-cluster-test-kit-executor, we > still have many thread leak when removing `waitForCondition` [0]. > > Adding log to show whether thread is alive when showing "Thread leak > detected" message, I found that detected thread is not alive. We may need to > consider adding `Thread::isAlive` to `DetectThreadLeak#of` filter. > > [0] > [https://ci-builds.apache.org/job/Kafka/job/kafka-pr/job/PR-16661/1/testReport/] > -- This message was sent by Atlassian Jira (v8.20.10#820010)