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 [classlib] Intermittent failures of UDP tests
Date Tue, 13 Feb 2007 15:05:00 GMT
Hi!

As you've probably noticed, sometimes we have a failures in Datagram* tests
(i.e. tests using UDP protocol like DatagramChannelTest, DatagramSocketTest
etc.)
See the beginning of the story here:
http://issues.apache.org/jira/browse/HARMONY-2338 and the discussion here:
http://comments.gmane.org/gmane.comp.java.harmony.devel/20884.

Now we have the following scheme for random (not-busy) ports generation for
java.net tests: use ServerSocket(0);
It works for TCP sockets, but for UDP sockets it sometimes fails as
operating system sometimes closes this ServerSocket too slowly so the code
trying to use this port gets "The address is already in use" kind of
exception (HARMONY-2860, HARMONY-3046, HARMONY-3156).

I've tried to implement the same approach but use new DatagramSocket() for
obtaining random port number for UDP tests (added it as a patch for
HARMONY-2860), but it also fails sometimes.

So, based on the previous discussions, we'll probably have 2 options of
fixing UDP tests without their re-writing:
  - Reserve several ports numbers and use them in cycle
  - Add the delay after obtaining the not-busy port (and hope that other
processes will not take this port while we're sleeping :-))

The 1-st from the above seems the most attractive choice.
The related questions:
  1) How may reserved ports do we need? IMHO, 3 for the beginning will be
enough
  2) What are exact numbers: Alexey Petrenko suggested starting from 63527
:-) Other options?

Thoughts?

If nobody objects i'll try to implement this scheme for port obtaining for
UDP tests.

Regards,
Mikhail

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