divijvaidya opened a new pull request, #13868:
URL: https://github.com/apache/kafka/pull/13868

   Fixes thread leaks by closing the ReplicaManager properly at the end of each 
test. The leaks were leading to flaky test failures in ReplicaManagerTest with 
errors such as:
   ```
   org.opentest4j.AssertionFailedError: Found unexpected 1 NonDaemon 
threads=kafka.server.ReplicaManagerTest:ReplicaFetcherThread-0-1 ==> expected: 
<0> but was: <1>
        at 
app//org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
        at 
app//org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
        at 
app//org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:197)
        at 
app//org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:150)
        at 
app//org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:560)
        at 
app//kafka.utils.TestUtils$.assertNoNonDaemonThreads(TestUtils.scala:1349)
        at 
app//kafka.server.ReplicaManagerTest.testBecomeFollowerWhileOldClientFetchInPurgatory(ReplicaManagerTest.scala:1911)
   ```
   
   **Note to reviewers:** Since I have added try/finally for a lot of tests, I 
would recommend to use the "Hide Whitespaces" option of GitHub while looking at 
the review.


-- 
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

Reply via email to