RFR: 8367561: Getting some "header" property from a file:// URL causes a file descriptor leak [v3]

Jaikiran Pai jpai at openjdk.org
Mon Oct 13 05:20:47 UTC 2025


On Wed, 8 Oct 2025 15:54:53 GMT, Volkan Yazici <vyazici at openjdk.org> wrote:

>>> If I'm not mistaken at least FileInputStream has a cleaner to close its file descriptor:
>>> 
>>> https://github.com/openjdk/jdk/blob/23fcbb0badbef6d22f63ca6c5b26b0693002592c/src/java.base/share/classes/java/io/FileInputStream.java#L140
>> 
>> 
>> You are right indeed - I have stared at that constructor code for several minutes but hadn't spotted this. I had additionally done a text search for "cleaner" in that class and only found their references in the javadoc text. Thank you for catching this. GC could indeed have played a role here.
>
> This is a very subtle detail, shall we document the rationale for `Reference.reachabilityFence(conn)`?

Hello Volkan, I've now added a comment in the test methods to explain why this line is present.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27633#discussion_r2425235121


More information about the net-dev mailing list