RFR: 8364427: JFR: Possible resource leak in Recording::getStream

Francesco Andreuzzi duke at openjdk.org
Thu Jul 31 13:01:56 UTC 2025


On Thu, 31 Jul 2025 12:17:47 GMT, Erik Gahlin <egahlin 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?

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/26575#discussion_r2245321075


More information about the hotspot-jfr-dev mailing list