RFR: 8364427: JFR: Possible resource leak in Recording::getStream
Francesco Andreuzzi
duke at openjdk.org
Thu Jul 31 13:39:54 UTC 2025
On Thu, 31 Jul 2025 13:35:35 GMT, Erik Gahlin <egahlin at openjdk.org> wrote:
>> If `nextChunk` returns `true` e.g. 2 times in a row, the second iteration of the while loop at L67 will overwrite `stream` without closing the previous instance. I don't see if/where `closeStream` will be called within two iterations of the loop, maybe I'm missing something?
>
> I think it's closed by the read methods or close(). Just to be sure, I inserted:
>
>
> + if (this.stream != null) {
> + throw new InternalError("Should not happen");
> + }
> stream = new BufferedInputStream(Files.newInputStream(currentChunk.getFile()));
>
>
> and ran all the tests without failure.
Thanks for the clarification
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26575#discussion_r2245429005
More information about the hotspot-jfr-dev
mailing list