Victoria Xia created KAFKA-14864: ------------------------------------ Summary: Memory leak in KStreamWindowAggregate with ON_WINDOW_CLOSE emit strategy Key: KAFKA-14864 URL: https://issues.apache.org/jira/browse/KAFKA-14864 Project: Kafka Issue Type: Bug Components: streams Reporter: Victoria Xia Assignee: Victoria Xia Fix For: 3.5.0
The Streams DSL processor implementation for the ON_WINDOW_CLOSE emit strategy during KStream windowed aggregations opens a key-value iterator but does not call `close()` on it ([link|https://github.com/apache/kafka/blob/5afedd9ac37c4d740f47867cfd31eaed15dc542f/streams/src/main/java/org/apache/kafka/streams/kstream/internals/AbstractKStreamTimeWindowAggregateProcessor.java#L203]), despite the Javadocs for the iterator making clear that users must do so in order to release resources ([link|https://github.com/apache/kafka/blob/5afedd9ac37c4d740f47867cfd31eaed15dc542f/streams/src/main/java/org/apache/kafka/streams/state/KeyValueIterator.java#L27]). I discovered this bug while running load testing benchmarks and noticed that some runs were sporadically hitting OOMs, so it is definitely possible to hit this in practice. -- This message was sent by Atlassian Jira (v8.20.10#820010)