[12] RFR 8042902: Test java/net/Inet6Address/serialize/Inet6AddressSerializationTest.java fails intermittently

Chris Yin xu.y.yin at oracle.com
Thu Sep 6 08:00:38 UTC 2018


Please have a review for below minor change to test java/net/Inet6Address/serialize/Inet6AddressSerializationTest.java, thanks

The bug has a long history, so a quick summary and explanation here, the issue which caused test failure before 2016 should already been fixed, so this fix change is for new observed failures in 2018. I checked all failures happened on Mac OS platform.
The failure is weird that we got different value by call InetAddress.getHostName() on same address one after one in very short time, cannot make sure whether any network configuration change or Mac OS system caused the difference for multiple name reverse lookup, but from this test aspect, guess the focus on address serialization should be enough, so below fix change is simple, we will call InetAddress.getHostName() first to set holder() ’s hostname field in testAllNetworkInterfaces() before serialization test (as Chris Hegarty commented in 2014. And per Mark's comments, "display call was commented out as it was too verbose" so we just simple print hostname instead of get whole display call function back), then when we deserialized the address object and do comparison with original one later, getHostName() call will retrieve holder() ’s hostname value directly, that should eliminate the possible difference when doing name reverse lookup twice.

bug: https://bugs.openjdk.java.net/browse/JDK-8042902

changes:

diff -r b51d348698c2 test/jdk/java/net/Inet6Address/serialize/Inet6AddressSerializationTest.java
--- a/test/jdk/java/net/Inet6Address/serialize/Inet6AddressSerializationTest.java	Wed Sep 05 19:40:52 2018 -0700
+++ b/test/jdk/java/net/Inet6Address/serialize/Inet6AddressSerializationTest.java	Thu Sep 06 14:29:38 2018 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -192,6 +192,7 @@
                     System.err.println("Testing with " + iadr);
                     System.err.println(" scoped iface: "
                             + i6adr.getScopedInterface());
+                    System.err.println(" hostname: " + i6adr.getHostName());
                     testInet6AddressSerialization(i6adr, null);
                 }
             }

Regards,
Chris


More information about the core-libs-dev mailing list