mumrah opened a new pull request, #12942: URL: https://github.com/apache/kafka/pull/12942
The anonymous functions we create in classes like Partition will end up getting held by the singleton Yammer metrics registry. ``` newGauge("UnderReplicated", () => if (isUnderReplicated) 1 else 0, tags) newGauge("InSyncReplicasCount", () => if (isLeader) partitionState.isr.size else 0, tags) newGauge("UnderMinIsr", () => if (isUnderMinIsr) 1 else 0, tags) newGauge("AtMinIsr", () => if (isAtMinIsr) 1 else 0, tags) newGauge("ReplicasCount", () => if (isLeader) assignmentState.replicationFactor else 0, tags) newGauge("LastStableOffsetLag", () => log.map(_.lastStableOffsetLag).getOrElse(0), tags) ``` This prevents GC from happening during test runs where we create lots of new BrokerServer/ControllerServer objects. In particular, we were seeing leaks of KafkaRaftClient which retains a fair amount of heap. This patch is a quick fix is to remove all the Yammer metrics from the registry between each test run. This should allow GC to occur as expected and improve overall heap usage during a test run. -- 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