JDK-6995195 : Static initialization deadlock in sun.java2d.loops.Blit / GraphicsPrimitive / GraphicsPrimitiveMgr
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 6u21,7
  • Priority: P3
  • Status: Closed
  • Resolution: Won't Fix
  • OS: generic
  • CPU: generic
  • Submitted: 2010-10-27
  • Updated: 2016-01-14
  • Resolved: 2016-01-14
Description
Stress test running several tests in separate threads intermittenly hangs with stack trace below.

The problem comes from circular dependency of static initialization of classes Blit / GraphicsPrimitive / GraphicsPrimitiveMgr. Deadlock happens like this:
- one of threads tries to initialize GraphicsPrimitiveMgr and calls static constructor, which calls native method initIDs which causes initialization of Blit in native code of initIDs
- another thread tries to initialize Blit, which causes initialization of GraphicsPrimitiveMgr (due to static constructor)

The code should be changed to avoid this circular dependency.

"Thread-5" prio=10 tid=0x08463000 nid=0x74ea in Object.wait() [0xcf2fc000]
   java.lang.Thread.State: RUNNABLE
        at sun.java2d.loops.Blit.<clinit>(Blit.java:96)
        at sun.java2d.x11.X11SurfaceData.<clinit>(X11SurfaceData.java:225)
        at sun.awt.X11GraphicsConfig.<clinit>(X11GraphicsConfig.java:58)
        at sun.awt.X11GraphicsDevice.makeDefaultConfiguration(X11GraphicsDevice.java:214)
        at sun.awt.X11GraphicsDevice.getDefaultConfiguration(X11GraphicsDevice.java:184)
        - locked <0xec06c588> (a java.lang.Object)
        at sun.awt.X11.XToolkit.<clinit>(XToolkit.java:92)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:169)
        at java.awt.Toolkit$2.run(Toolkit.java:834)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:826)
        - locked <0xd0df4d40> (a java.lang.Class for java.awt.Toolkit)
        at javasoft.sqe.tests.api.java.awt.Image.ImageFilter.SetPixelsTests.ImageFilter1004(SetPixelsTests.java:157)
        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 nsk.stress.share.StressTest$TestThread.runTest(StressTest.java:739)
        at nsk.stress.share.StressTest$TestThread.run(StressTest.java:755)

"Thread-2" prio=10 tid=0x084f8000 nid=0x74e7 in Object.wait() [0xcf4e3000]
   java.lang.Thread.State: RUNNABLE
        at sun.java2d.loops.GraphicsPrimitiveMgr.initIDs(Native Method)
        at sun.java2d.loops.GraphicsPrimitiveMgr.<clinit>(GraphicsPrimitiveMgr.java:38)
        at sun.java2d.loops.DrawLine.locate(DrawLine.java:37)
        at sun.java2d.SurfaceData.makeRenderLoops(SurfaceData.java:699)
        at sun.awt.image.BufImgSurfaceData.getSolidLoops(BufImgSurfaceData.java:345)
        - locked <0xd1172ec0> (a java.lang.Class for sun.awt.image.BufImgSurfaceData)
        at sun.awt.image.BufImgSurfaceData.initSolidLoops(BufImgSurfaceData.java:330)
        at sun.awt.image.BufImgSurfaceData.createData(BufImgSurfaceData.java:220)
        at sun.awt.image.CachingSurfaceManager.<init>(CachingSurfaceManager.java:156)
        at sun.java2d.x11.X11CachingSurfaceManager.<init>(X11CachingSurfaceManager.java:56)
        at sun.java2d.SurfaceManagerFactory.createCachingManager(SurfaceManagerFactory.java:36)
        at sun.awt.image.SurfaceManager.getManager(SurfaceManager.java:54)
        at sun.java2d.SurfaceData.getDestSurfaceData(SurfaceData.java:123)
        at sun.java2d.SunGraphicsEnvironment.createGraphics(SunGraphicsEnvironment.java:389)
        at java.awt.image.BufferedImage.createGraphics(BufferedImage.java:1137)
        at java.awt.image.BufferedImage.getGraphics(BufferedImage.java:1125)
        at javasoft.sqe.tests.api.java.awt.Image.BufferedImage.GetTest.testCase3(GetTest.java:195)
        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 nsk.stress.share.StressTest$TestThread.runTest(StressTest.java:739)
        at nsk.stress.share.StressTest$TestThread.run(StressTest.java:755)

Comments
No plans to address for this release family. If there is a concern, please open a new bug against JDK >= 8 and provide a test case.
14-01-2016

- this is an issue reported against 7(7u), - there are now affected version 9 filed for this issue - 7u issues are transferred to Sustaining Nevertheless if someone have a report against 9 - please reopen and add affectedVersion 9 or 7u specific escalations might be reopen to Sustaining
10-08-2014

These are all approved for deferral to JDK 9 so you can update the FixVersion to state JDK 9. Kind regards, Mathias
29-08-2013

These are all approved for deferral to JDK 9 so you can update the FixVersion to state JDK 9. Kind regards, Mathias
29-08-2013

These are all approved for deferral to JDK 9 so you can update the FixVersion to state JDK 9. Kind regards, Mathias
29-08-2013

Converted "8-client-defer-candidate" label to "8-defer-request" by SQE' OK.
15-08-2013

*This is anti-deferral criteria list*: - P2 -------------- Engineering's Criteria ------------------------------------- - tck-red labeled - conformance labeled - P3 regressions reported/labeled against jdk8 - findbugs, parfait, eht labeled bugs - CAP <1 year reported - netbeans <1 year reported Victor ----------------- SQE's OK --------------------------------- Yes, we are ok with that thanks, Mikhail
15-08-2013