JDK-8187662 : JCK 6b: Serialization JCK tests failures in the 'AggressiveOpt' mode
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.io:serialization
  • Affected Version: 6u171
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2017-09-19
  • Updated: 2017-10-03
  • Resolved: 2017-09-20
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6u171Fixed
Description
Some of the tests mentioned below failing with the reason of 
java.lang.NoSuchMethodError: java.util.HashMap.roundUpToPowerOf2 
AND
java.lang.IllegalStateException: unread block data

Tests failing
-----------------
api/java_util/serialization/descriptions.html#HashSet 
api/javax_print/attribute/standard/JobStateReasons/serial/index.html#Input
api/javax_management/jmx_serial/openmbean/OpenMBeanParameterInfoSupport/serial/index.html#Input
api/java_awt/TextArea/AccessibleAWTTextArea/serial/index.html#Constructor
api/java_awt/TextComponent/AccessibleAWTTextComponent/serial/index.html#Constructor
api/java_awt/TextArea/AccessibleAWTTextArea/serial/index.html#Input 
api/java_awt/TextComponent/AccessibleAWTTextComponent/serial/index.html#Input
api/java_awt/serialization/descriptions.html#Component
api/java_awt/serialization/descriptions.html#Container
api/java_awt/serialization/descriptions.html#TextArea 
api/java_awt/serialization/descriptions.html#TextComponent
api/javax_management/remote/security/index.html#RmiIiopMBeanServerForwarderTest
api/javax_management/remote/security/index.html#RmiJrmpMBeanServerForwarderTest
api/javax_management/remote/protocol/RmiMBeanServerRequestTest.html#RmiMBeanServerRequestTest
api/javax_management/remote/security/index.html#RmiIiopMBeanServerConnectionTest
api/javax_management/remote/security/index.html#RmiJrmpMBeanServerConnectionTest
api/javax_management/remote/loading/index.html#RmiIiopServerDefaultClassLoaderTest
api/javax_management/remote/loading/index.html#RmiJrmpServerDefaultClassLoaderTest 
api/javax_management/remote/security/index.html#RmiIiopSubjectDelegationTest
api/javax_management/remote/security/index.html#RmiJrmpSubjectDelegationTest
api/javax_management/remote/rmi/RMIConnection/index.html#RMIConnectionTest

Reproduced with the below piece of code:
-------------------------------------------------------

HashSet hashSet = new HashSet();
        hashSet.add("krishna");

        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
        try {
            ObjectOutputStream objectOutputStream = new ObjectOutputStream(byteArrayOutputStream);
            objectOutputStream.writeObject(hashSet);
            ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(byteArrayOutputStream.toByteArray());
            ObjectInputStream objin = new ObjectInputStream(byteArrayInputStream);
            System.out.println("the objin "+objin);
            try {
                objin.readObject();
                System.out.println("After readObject");

            } catch (ClassNotFoundException e) {
                e.printStackTrace();
            }
        } catch (IOException e) {
            e.printStackTrace();
        }

NOTE : The tests are failing only in "AggressiveOpt" mode.


Comments
Hi Govindan, I'm not sure. Can you point me to the specific tests you have in mind. I would expect that since the new field is package private it would not cause trouble. (and the checks you outline here are all for public fields / methods)
20-09-2017

Hi Robert, can you please ensure at least jck static signature tests passes? I am suspecting newly added field "static final int MAXIMUM_CAPACITY" will impact static signature test into passing. Current signature tests coverage on HashSet (jck6b) ============================================ CLSS public java.util.HashSet<%0 extends java.lang.Object> cons public HashSet() cons public HashSet(int) cons public HashSet(int,float) cons public HashSet(java.util.Collection<? extends {java.util.HashSet%0}>) intf java.io.Serializable intf java.lang.Cloneable intf java.util.Set<{java.util.HashSet%0}> meth public boolean add({java.util.HashSet%0}) meth public boolean contains(java.lang.Object) meth public boolean isEmpty() meth public boolean remove(java.lang.Object) meth public int size() meth public java.lang.Object clone() meth public java.util.Iterator<{java.util.HashSet%0}> iterator() meth public void clear() supr java.util.AbstractSet<{java.util.HashSet%0}> hfds PRESENT,map,serialVersionUID
20-09-2017

Critical Request Template - Justification : tck red ���- Risk Analysis :��� minimal - reimplementation of a method in a neighboring class - Webrev : http://t4.ie.oracle.com/home/robm/files/webrev/8187662/webrev.01/ - Testing (done/to-be-done) : unit test, redo jck - Back ports (done/to-be-done) : n/a ���- FX Impact : (Client bugs only)��� - Fix For Release : JDK6u171
20-09-2017

This issue not seen with 8u152b16, 8u151b11, 7u161b11 while checked atleast with one test api/java_util/HashSet/serial/index.html#InputTests by option -XX:+AggressiveOpts Test Passed.
20-09-2017

https://wiki.shibboleth.net/confluence/display/SHIB2/IdPClusterIssues AggressiveOpts swaps out HashMap for TreeMap. This causes the method to not be found by HashSet. The fix is to add this method to HashSet. Isn't AggressiveOpts experimental? Why is this tck-red?
19-09-2017

(see JCK-7308799) as Govindan found this could be related to JDK-8174112
19-09-2017