JDK-8028486 : java/awt/Window/WindowsLeak/WindowsLeak.java fails
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 8,9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: os_x
  • Submitted: 2013-11-17
  • Updated: 2016-10-13
  • Resolved: 2016-05-28
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 8 JDK 9
8u112Fixed 9 b124Fixed
Description
fails on jdk1.8.0b115, jdk1.8.0b114 and jdk1.7.0_45b18

----------System.out:(0/0)----------
----------System.err:(13/777)----------
java.lang.RuntimeException: Test FAILED: Window list is not empty: 87
	at WindowsLeak.main(WindowsLeak.java:66)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:483)
	at com.sun.javatest.regtest.MainWrapper$MainThread.run(MainWrapper.java:94)
	at java.lang.Thread.run(Thread.java:744)

JavaTest Message: Test threw exception: java.lang.RuntimeException: Test FAILED: Window list is not empty: 87
JavaTest Message: shutting down test

STATUS:Failed.`main' threw exception: java.lang.RuntimeException: Test FAILED: Window list is not empty: 87
result: Failed. Execution failed: `main' threw exception: java.lang.RuntimeException: Test FAILED: Window list is not empty: 87


test result: Failed. Execution failed: `main' threw exception: java.lang.RuntimeException: Test FAILED: Window list is not empty: 87

Comments
I came across a leak issue in IDEA/jdk8 which leaded to this test case. Some investigation revealed the following issue. Please open the attached screenshot, made with YourKit, where a chain of links is shown from the GC roots. The frame is held by its peer which is held by CGLLayer which is held as validatedSrcData in the GL context. The point is that the GL context doesn't cleanup the last state until under some conditions, which are not applicable to this scenario. I'm not sure should the cleanup be triggered here or not, but the problem can be solved otherwise. The point is that in the chain the CGLLayer instance has been disposed, in response to the frame disposal. So, this is the only ref that holds it (the JNI ref is released by the native peer on disposal). Thus, as the layer is disposed it can at least zero all the java refs it holds (this change already fixes the problem). Then, the "layer" ref in CGLLayerSurfaceData should probably be made weak. I'll post the fix to the alias.
29-04-2016

RULE java/awt/Window/WindowsLeak/WindowsLeak.java Exception java.lang.RuntimeException: Test FAILED: Window list is not empty: ...
24-03-2015

Test fails on JDK 8 b132 , JDK 8u10 b10 and JDK 9 b09 on Mac with the same exception
28-04-2014

This is a test issue. This is a new test and it was introduced in JDK-8013563.
18-11-2013