gharris1727 commented on PR #15101:
URL: https://github.com/apache/kafka/pull/15101#issuecomment-1888225488

   > One reason that some stream tests are failing because they use the same 
server for the duration of the entire test suite and don't create a server per 
test, for example MetricsIntegrationTest.shouldAddMetricsOnAllLevels().
   > Should we change our logic to test for these leaked threads at the end of 
every test class, instead of at the end of every test?
   
   @divijvaidya The stateful strategy of diffing the threads before and after 
each test should exclude the test-suite threads which are created before the 
test method begins. What is probably happening here is that there are some 
threads being lazily created as a side-effect of the actions of the test but 
which are not cleaned up immediately, but are later cleaned up by the whole 
cluster shutting down.
   
   I wouldn't recommend immediately reducing the scope to the Class-only 
enforcement, as it makes it so much harder to blame specific tests which 
contain leaks. It's so much more helpful to get a "This test leaked a thread" 
warning than a "this suite leaked a test" warning, especially when the 
assertion doesn't tell you where the thread is being allocated.
   
   As far as what to do next:
   
   1. You could figure out how to disable the lazy threads with some 
development-only configuration 
   2. You could figure out how to clean up these lazy threads, either 
automatically or with a development-only hint method.
   3. You could give these particular threads special privileges (by adding to 
the expected thread names)
   4. You could give these particular tests special privileges (with an 
`Ignore` annotation)
   
   These are technically leaks, and the extension is correctly finding them. 
It's up to us to figure out if they're worth fixing or if they're generally 
harmless.
   


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