Steven Schlansker created KAFKA-19680: -----------------------------------------
Summary: NoSuchElementException (again) in Kafka Streams iterator metrics Key: KAFKA-19680 URL: https://issues.apache.org/jira/browse/KAFKA-19680 Project: Kafka Issue Type: Bug Affects Versions: 4.1.0 Reporter: Steven Schlansker Since upgrading to Kafka Streams 4.1.0, we again see in our metrics collection: {code:java} Exception thrown from GraphiteReporter#report. Exception was suppressed. java.util.NoSuchElementException: null at java.base/java.util.concurrent.ConcurrentSkipListMap.firstKey(ConcurrentSkipListMap.java:1863) at java.base/java.util.concurrent.ConcurrentSkipListSet.first(ConcurrentSkipListSet.java:393) at org.apache.kafka.streams.internals.metrics.OpenIterators.lambda$add$0(OpenIterators.java:57) at org.apache.kafka.common.metrics.KafkaMetric.metricValue(KafkaMetric.java:81) {code} It seems that unfortunately the dynamic metric registration introduced in [https://github.com/apache/kafka/pull/20022] undid the fix from [https://github.com/apache/kafka/pull/18771] There is still a race between the metric gauge being removed, and the last open iterator being removed from the tracking set. The same fix from #18771 would fix the issue again. -- This message was sent by Atlassian Jira (v8.20.10#820010)