RFR 8085875/10, java/net/DatagramSocket/PortUnreachable.java fails intermittently: Address already in use

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

RFR 8085875/10, java/net/DatagramSocket/PortUnreachable.java fails intermittently: Address already in use

FELIX YANG
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

Reply | Threaded
Open this post in threaded view
|

RE: RFR 8085875/10, java/net/DatagramSocket/PortUnreachable.java fails intermittently: Address already in use

Langer, Christoph
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:[hidden email]] On Behalf Of
> Felix Yang
> Sent: Mittwoch, 6. September 2017 10:06
> To: [hidden email]; Mark Sheppard
> <[hidden email]>
> 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

Reply | Threaded
Open this post in threaded view
|

Re: RFR 8085875/10, java/net/DatagramSocket/PortUnreachable.java fails intermittently: Address already in use

Mark Sheppard
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:[hidden email]] On Behalf Of
>> Felix Yang
>> Sent: Mittwoch, 6. September 2017 10:06
>> To: [hidden email]; Mark Sheppard
>> <[hidden email]>
>> 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

Reply | Threaded
Open this post in threaded view
|

RE: RFR 8085875/10, java/net/DatagramSocket/PortUnreachable.java fails intermittently: Address already in use

Langer, Christoph
Hi Mark,

I overlooked that, you are completely right, recreateServerSocket is fine then.

Best regards
Christoph

> -----Original Message-----
> From: Mark Sheppard [mailto:[hidden email]]
> Sent: Donnerstag, 7. September 2017 13:07
> To: Langer, Christoph <[hidden email]>; Felix Yang
> <[hidden email]>
> Cc: [hidden email]
> Subject: Re: RFR 8085875/10,
> java/net/DatagramSocket/PortUnreachable.java fails intermittently: Address
> already in use
>
> 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:[hidden email]] On Behalf Of
> >> Felix Yang
> >> Sent: Mittwoch, 6. September 2017 10:06
> >> To: [hidden email]; Mark Sheppard
> >> <[hidden email]>
> >> 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

Reply | Threaded
Open this post in threaded view
|

Re: RFR 8085875/10, java/net/DatagramSocket/PortUnreachable.java fails intermittently: Address already in use

FELIX YANG
Hi Mark and Christoph,

      thanks for the comment.

     Pushed with changing max tries count into a "staic final int" field
and removed the in-necessary space character.

-Felix
On 2017/9/7 22:04, Langer, Christoph wrote:

> Hi Mark,
>
> I overlooked that, you are completely right, recreateServerSocket is fine then.
>
> Best regards
> Christoph
>
>> -----Original Message-----
>> From: Mark Sheppard [mailto:[hidden email]]
>> Sent: Donnerstag, 7. September 2017 13:07
>> To: Langer, Christoph <[hidden email]>; Felix Yang
>> <[hidden email]>
>> Cc: [hidden email]
>> Subject: Re: RFR 8085875/10,
>> java/net/DatagramSocket/PortUnreachable.java fails intermittently: Address
>> already in use
>>
>> 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:[hidden email]] On Behalf Of
>>>> Felix Yang
>>>> Sent: Mittwoch, 6. September 2017 10:06
>>>> To: [hidden email]; Mark Sheppard
>>>> <[hidden email]>
>>>> 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