RFR: 8237834: com/sun/jndi/ldap/LdapDnsProviderTest.java failing with LDAP response read timeout

Daniel Fuchs daniel.fuchs at oracle.com
Thu May 7 10:10:59 UTC 2020


Hi Aleksei,

I agree with the general idea. However, the method:

  215     private static int generateUnseenPort() {
  216         int port;
  217         do {
  218             port = 1111 + RND.nextInt(1000);
  219         } while (SEEN_PORTS.contains(port));
  220         SEEN_PORTS.add(port);
  221         return port;
  222     }

might never return - if none of the port in the range
[1111, 2111] are free. Arguably, the test will have
failed in timeout before that. But maybe an assertion
error should be thrown if that happens.

best regards,

-- daniel


On 07/05/2020 00:52, Aleks Efimov wrote:
> Hi,
> 
> LdapDnsProviderTest test expects to have no services running on 1111 
> port on test machine. That could cause it to fail intermittently due to 
> unexpected exception message thrown by LDAP client, i.e. timeout or 
> disconnect instead of expected connection refusal.
> 
> The proposed fix tries to make test more stable ('intermittent' key was 
> still added) by running test cases with non-default port multiple times 
> by trying to use different random port numbers ('randomness' key was 
> added) for each run.
> 
> Webrev: http://cr.openjdk.java.net/~aefimov/8237834/00/index.html
> 
> JBS: https://bugs.openjdk.java.net/browse/JDK-8237834
> 
> Test was not observed to fail for over 300 iterations.
> 
> With Best Regards,
> Aleksei
> 



More information about the core-libs-dev mailing list