harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mikhail Markov" <mikhail.a.mar...@gmail.com>
Subject Re: [classlib] Intermittent failures of UDP tests
Date Wed, 14 Feb 2007 14:00:14 GMT
On 2/14/07, Gregory Shimansky <gshimansky@gmail.com> wrote:
>
> On Tuesday 13 February 2007 21:59 Mikhail Markov wrote:
> > > I don't quite get it. Is it operating system to be blamed or the code
> > > for ServerSocket(0) which returns a port that is still used by some
> >
> > socket?
> >
> > No, the code for obtaining the available port is the following (
> > tests.support.Support_PortManager):
> >     ServerSocket ss = new ServerSocket(0);
> >     int port = ss.getLocalPort();
> >     ss.close();
> >     return port;
> > It works ok: creates a ServerSocket on a not-busy port, but when we try
> to
> > use this port number somewhere in the test for creating a new Sockets,
> we
> > get the mentioned "Address already in use" exception. Seems like the
> > ServerSocket is not fully closed at the moment we're trying to use the
> > generated port.
>
> I just don't understand it why creating a socket on a non-busy port as you
> say
> results in an exception that it is actually still busy. Does this test
> behave
> in the same way on RI?


Yes - i observe the same behaviour on RI as well.
Operating system could potentially have a port on a busy state for a period
of time after the socket was really closed.
I'll try to use setReuseAddress(true) as was suggested by Andrew. Hope
this'll help.

Regards,
Mikhail


--
> Gregory
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message