Code Review 7098719: -Dsun.net.maxDatagramSockets and Socket constructor does not work correctly with System.gc()
Chris Hegarty
chris.hegarty at oracle.com
Fri Oct 7 06:40:51 PDT 2011
Michael, Alan,
This is a follow up to CR 7073491 where the same issue was addressed in
DatagramSocket. This CR proposes to address the same problem exposed
through deprecated java.net.Socket(InetAddress host, int port, boolean
stream).
The problem is in AbstractPlainSocketImpl.create(). If
ResourceManager.beforeUdpCreate() throws an exception then fd is left
set. When the finalizer for this object runs it will invoke close() and
decrement the counter, thus double counting the close. It only happens
via the finalizer because the impl is not returned to the application,
because the original exception is thrown from a Socket constructor.
http://cr.openjdk.java.net/~chegar/7098719/webrev.00/webrev/
-Chris.
More information about the net-dev
mailing list