Hi all, I have submitted a PR (https://github.com/apache/pulsar/pull/21450) which includes changes to add reporting and tooling to detect thread leaks in Pulsar tests.
It should be ensured in each test that resources created by the test are properly cleaned up. Failing to do so can lead to memory leaks and, in some instances, unnecessary CPU consumption. These issues can, in turn, slow down test execution, increase Pulsar CI build durations, and cause flakiness. A significant source of memory leaks in Pulsar tests stems from thread leaks. After the PR is merged, it will be easy to detect thread leaks since the build will add warnings to the summary view for the GitHub Actions build run. An example can be seen in the PR build run: https://github.com/apache/pulsar/actions/runs/6680066364?pr=21450 . There will be more detailed information in the "Report detected thread leaks" build step, for example https://github.com/apache/pulsar/actions/runs/6680066364/job/18153890519?pr=21450#step:16:23 . Please review the PR https://github.com/apache/pulsar/pull/21450 so that we can continue to get rid of the remaining thread leaks in the future and keep the tests cleaner and less flaky. -Lari