Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6995195

Static initialization deadlock in sun.java2d.loops.Blit / GraphicsPrimitive / GraphicsPrimitiveMgr

    Details

    • Subcomponent:
      2d
    • CPU:
      generic
    • OS:
      generic

      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)

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              nhaustov Nicolay Haustov (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: