[
https://issues.apache.org/jira/browse/KAFKA-17499?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17891978#comment-17891978
]
Matthias J. Sax commented on KAFKA-17499:
-----------------------------------------
It was never confirmed as a bug (and "affected version" is supposedly 3.8, so
3.6 should be out of the picture in any case). As pointed out already, user
code is responsible to close iterators it gets from IQ – this did not happen in
the example with growing memory consumption. Thus, it still sounds like there
is no problem after all, but it's a user error to not close the iterator.
I would still vote to close this ticket as "not a problem".
> Memory leak when using ReadOnlyKeyValueStore `all()` method
> -----------------------------------------------------------
>
> Key: KAFKA-17499
> URL: https://issues.apache.org/jira/browse/KAFKA-17499
> Project: Kafka
> Issue Type: Bug
> Components: streams
> Affects Versions: 3.8.0
> Reporter: James Cook
> Assignee: Bill Bejeck
> Priority: Major
> Attachments: Screenshot 2024-09-09 at 08.31.57.png, Screenshot
> 2024-09-09 at 08.32.16.png, Screenshot 2024-09-09 at 08.32.25.png, Screenshot
> 2024-09-09 at 08.35.07.png
>
>
> There is a memory leak when using the `.all()` method of
> ReadOnlyKeyValueStore (specifically MeteredTimestampedKeyValueStore).
> I have recreated the problem in a small app here:
> [https://github.com/jamescookie/kafka-stream-memory-leak]
> When I run the test method using 3.8.0, I get this memory footprint:
> !Screenshot 2024-09-09 at 08.31.57.png!
> In a little over 90 seconds the number of `java.util.TreeMap$Entry` grows to
> over 10 million:
> !Screenshot 2024-09-09 at 08.32.16.png!
> !Screenshot 2024-09-09 at 08.32.25.png!
>
> When running against 3.7.1, this does not happen:
> !Screenshot 2024-09-09 at 08.35.07.png!
>
> The workaround (and correct way of coding) is to wrap a try-with-resources
> statement around the `store.all()`.
> I think this has been caused by this
> [commit|https://github.com/apache/kafka/pull/15219/files] to fix KAFKA-15770
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)