RFR: 8364427: JFR: Possible resource leak in Recording::getStream
Erik Gahlin
egahlin at openjdk.org
Thu Jul 31 13:08:57 UTC 2025
On Thu, 31 Jul 2025 12:59:10 GMT, Francesco Andreuzzi <duke at openjdk.org> wrote:
>> Could I have a review of the PR that fixes resource leaks when Recording::getStream is used?
>>
>> Testing: tier1 + test/jdk/jdk/jfr
>>
>> Thanks
>> Erik
>
> src/jdk.jfr/share/classes/jdk/jfr/internal/ChunkInputStream.java line 69:
>
>> 67: while (nextChunk()) {
>> 68: try {
>> 69: stream = new BufferedInputStream(Files.newInputStream(currentChunk.getFile()));
>
> Should we close `stream` if it's not null?
Could you elaborate?
There is closeStream method that is called when there is no more data to be read.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26575#discussion_r2245341547
More information about the hotspot-jfr-dev
mailing list