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 09:59:45 PDT 2011
On 10/ 7/11 05:58 PM, Michael McMahon wrote:
> Looks fine. Possibly the comment
> line at 102:AbstractPlainSocketImpl.java is not really
> needed/appropriate though.
True. I'll remove it.
Thanks,
-Chris.
>
> - Michael.
>
> On 07/10/11 06:40, Chris Hegarty wrote:
>> 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