JDK-6612497 : api/java_awt/Container/index.html#isAncestorOf Container2019 hangs since JDK 7 b15
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: OpenJDK6,7
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: generic,linux
  • CPU: generic,x86
  • Submitted: 2007-10-03
  • Updated: 2012-03-22
  • Resolved: 2009-11-18
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 7 Other
7 b25Fixed OpenJDK6Fixed
Related Reports
Duplicate :  
Relates :  
Description
JCK: JCK-runtime-6b b07
J2SE: FAIL - 7 b15 PASS 7 b14 6u4 b03 6u2 b05
Platform[s]: FAIL -  All
switch/Mode: FAIL - default

Test api/java_awt/Container/index.html#isAncestorOf hangs since JDK 7 b15. The problematic code is

Container[] p=new Container[50]; //step Create array of containers
p[0] = new Container();
for (int i=1;i<50;i++) {
	p[i-1].add(p[i] = new Container()); //step Create hierarchy
}

6u2 and 7 b14 finish execution of this code almost immediately. 7 b15 executes first ~25 iterations very fast, next ~10 quite slow and looks like locks up at ~35th iteration. Probably this test still can pass after several  hours of waiting.

Comments
EVALUATION The 6567564 fix improves some code, in particular, the getGC method of the Component class. Here's old version of the method (before fix): public GraphicsConfiguration getGraphicsConfiguration() { synchronized(getTreeLock()) { if (graphicsConfig != null) { return graphicsConfig; } else if (getParent() != null) { return getParent().getGraphicsConfiguration(); } else { return null; } } } Here's new version of the method (after fix): public GraphicsConfiguration getGraphicsConfiguration() { synchronized(getTreeLock()) { GraphicsConfiguration gc = graphicsConfig; Component parent = getParent(); while ((gc == null) && (parent != null)) { gc = parent.getGraphicsConfiguration(); parent = parent.getParent(); } return gc; } } Undoubtedly, the changes transform the recursive method into a simple loop. But the method is still recursive. It's probably by mistake. A possible fix - roll back the changes.
21-11-2007

EVALUATION I have created a simple standalone test (attached) which can be used to reproduce the problem without JCK test suite. An interesting thing is that having p[0] an empty container is required for the test failure, while with p[0] = f the test passes. At first I thought this problem was related to the fix for 4811096, but that fix is integrated into 7.0-b19 only. Most probably this is a regression from 6567564.
30-10-2007