On Wed, 8 Oct 2025 13:29:19 GMT, Jaikiran Pai <[email protected]> wrote:
>> Thanks for adding the reachability fence. An other possibility would have >> been to temporarily stash `conn` in a static field. > >> 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)`? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/27633#discussion_r2414338877
