JDK-6697660 : Multiple JCK tests fails with java.lang.IllegalStateException for 6u10 b23
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 6u10
  • Priority: P1
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2008-05-05
  • Updated: 2012-03-22
  • Resolved: 2008-05-23
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
6u10 b25Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Description
JCK            : JCK-runtime-6a b14
J2SE           : FAIL - jdk6u10 build 23
Platform[s]    : FAIL - Windows (XP prof., Vista, 2008) x86, solaris10 sparc
switch/Mode    : FAIL - any

Tests passes with jdk6u10 build 22

Test case api/java_awt/serialization/descriptions.html#Window[testWrite] fails with exception
java.lang.IllegalStateException: This function should be called while holding treeLock
Stack trace:
        at java.awt.Container.checkTreeLock(Container.java:397)
        at java.awt.Container.adjustListeningChildren(Container.java:1262)
        at java.awt.Container.readObject(Container.java:3582)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:974)
        at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1849)
        at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
        at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
        at javasoft.sqe.javatest.lib.SerializeTest.read(SerializeTest.java:413)
        at javasoft.sqe.javatest.lib.SerializeTest.testWrite(SerializeTest.java:346)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at javasoft.sqe.javatest.lib.MultiTest.invokeTestCase(MultiTest.java:406)
        at javasoft.sqe.javatest.lib.MultiTest.run(MultiTest.java:195)
        at javasoft.sqe.javatest.lib.MultiTest.run(MultiTest.java:127)
        at javasoft.sqe.tests.api.java.awt.serialization.WindowTests.main(WindowTests.java:143)

Following test cases also fails with the same exception:
api/java_awt/serialization/descriptions.html#ScrollPane[testWrite]
api/java_awt/serialization/descriptions.html#Container[testWrite]
api/java_awt/Container/serial/index.html#Input[serial2002]

Following tests are also affected:
api/java_awt/serialization/descriptions.html#Component[testRead]
api/java_awt/serialization/descriptions.html#Container[testRead]
api/java_awt/serialization/descriptions.html#Dialog[testRead]
api/java_awt/serialization/descriptions.html#FileDialog[testRead]
api/java_awt/serialization/descriptions.html#Frame[testRead]
api/java_awt/serialization/descriptions.html#MediaTracker[testRead]
api/java_awt/serialization/descriptions.html#Panel[testRead]
api/java_awt/serialization/descriptions.html#ScrollPane[testRead]
api/java_awt/serialization/descriptions.html#Window[testRead]

Steps to reproduce:
1. Login to solaris machine. Install JDK and JCK of the versions mentioned above.
2. Execute command
/export/JDK/jdk1.6.0_10/bin/java -classpath /export/JCK/JCK-runtime-6a/classes:/export/JDK/jdk1.6.0_10/lib/tools.jar javasoft.sqe.tests.api.java.awt.serialization.WindowTests -TestCaseID testWrite -TestURL file:///export/JCK/JCK-runtime-6a/tests/api/java_awt/serialization/descriptions.html#Window -FileName window.ser

where /export/JDK/jdk1.6.0_10 - is a directory where JDK installed
and /export/JCK/JCK-runtime-6a - is a directory where JCK installed
3. You'll see a stack trace mentioned above.

Test sources could be found at 
JCK-runtime-6a/src/share/classes/javasoft/sqe/javatest/lib/SerializeTest.java
JCK-runtime-6a/tests/api/java_awt/serialization/WindowTests.java

It is possible that this problem is caused by CR 6690068

Comments
EVALUATION Introduced by the fix for 6616323 which introduced a number of new calls to checkTreeLock(). Container.adjustListeningChildren() now calls checkTreeLock() whereas it didn't before. Since readObject() doesn't attempt to obtain the treelock this means readObject() is guaranteed to fail. Serialization isn't a typical case so its unlikely to be a problem in apps. But its not clear if any of the other additional calls to checkTreeLock() would show up the same problem in more commonly travelled code paths.
05-05-2008