RFR 8085875/10, java/net/DatagramSocket/PortUnreachable.java fails intermittently: Address already in use
Mark Sheppard
mark.sheppard at oracle.com
Thu Sep 7 11:06:52 UTC 2017
Hi Christoph,
looking at the logic of the test, it is seen that a "server socket"
is created in the execute method, and is then closed,
and a bunch of datagrams sent to it. Then in the serverSend method an
attempt is made to (re-)create a DatagramSocket using the
same port as the original "server socket", so recreate would seem to
convey an appropriate semantics.
WRT an upper limit for retryCount, that's a reasonable point, but
probably a "static final int" rather than just static field.
regards
Mark
On 07/09/2017 10:40, Langer, Christoph wrote:
> Hi Felix,
>
> this looks good in general.
>
> I would, however, suggest to rename the method 'recreateServerSocket' into ' createServerSocket' as the former name suggests that something which existed once was recreated. But in this case the socket is simply created with a few retries when exceptions occur.
>
> I'd also prefer if the retry count could be stored in a static field to allow for easy modification, instead of literally coding it to the value of 5 in the method.
>
> And a minor thing: in line 63 there's a blank in between "recreateServerSocket" and "(int serverPort)" which should be removed.
>
> Best regards
> Christoph
>
>> -----Original Message-----
>> From: net-dev [mailto:net-dev-bounces at openjdk.java.net] On Behalf Of
>> Felix Yang
>> Sent: Mittwoch, 6. September 2017 10:06
>> To: net-dev at openjdk.java.net; Mark Sheppard
>> <mark.sheppard at oracle.com>
>> Subject: RFR 8085875/10, java/net/DatagramSocket/PortUnreachable.java
>> fails intermittently: Address already in use
>>
>> Hi all,
>>
>> please review a patch to add retries to avoid possible port
>> conflicts during re-binding.
>>
>> Bug:
>>
>> https://bugs.openjdk.java.net/browse/JDK-8085875
>>
>> Webrev:
>>
>> http://cr.openjdk.java.net/~xiaofeya/8085875/webrev.00/
>>
>> Thanks,
>>
>> Felix
More information about the net-dev
mailing list