RFR: 8212136: Remove BaseSSLSocketImpl finalizer method
Xue-Lei Andrew Fan
xuelei at openjdk.java.net
Thu Apr 7 23:12:40 UTC 2022
On Thu, 7 Apr 2022 22:49:24 GMT, Bradford Wetmore <wetmore at openjdk.org> wrote:
> > The socket close() call in the finalize() method may be blocked for the SSL implementation, which is not good for garbage collection. It should be safe by just removing the finalize() method.
`>
> Can you provide more detail? I expected something more like your first attempt (`java.lang.ref.Cleaner`) that would properly close/send the close_notify message. Thanks!
The 1st use of Cleaner refer to 'this' object, as result in that 'this' object cannot be phantom reachable and thus the cleaner cannot be triggered. As the close() is a method of 'this' object, the calling to close() in a cleaner will hold a reference to 'this' object, and make the cleaner failed (and memory leak).
-------------
PR: https://git.openjdk.java.net/jdk/pull/8065
More information about the security-dev
mailing list