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

Static initialization deadlock between sun.awt.Win32GraphicsEnvironment and sun.awt.windows.WToolkit

    Details

    • Subcomponent:
    • Resolved In Build:
      b140
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      Description

      Stress test running several tests in separate threads hangs with stack trace below.

      The problem is caused by circular dependency of static constructors of sun.awt.Win32GraphicsEnvironment and sun.awt.windows.WToolkit: first calls WToolkit.loadLibraries() and second one Win32GraphicsEnvironment.init(). This may cause deadlock if AWT is called from multiple threads.

      The bug is Windows only.

      "Thread-337" prio=6 tid=0x4e8db400 nid=0x1e788 in Object.wait() [0x4c8df000]
         java.lang.Thread.State: RUNNABLE
              at sun.awt.Win32GraphicsEnvironment.<clinit>(Win32GraphicsEnvironment.java:69)
              at java.lang.Class.forName0(Native Method)
              at java.lang.Class.forName(Class.java:186)
              at java.awt.GraphicsEnvironment.createGE(GraphicsEnvironment.java:102)
              at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:81)
              - locked <0x05aed0a8> (a java.lang.Class for java.awt.GraphicsEnvironment)
              at java.awt.image.BufferedImage.createGraphics(BufferedImage.java:1152)
              at javasoft.sqe.tests.api.java.awt.java2d.image.BufferedImage.GetTest.testCase40(GetTest.java:1728)
              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:613)
              at javasoft.sqe.jck.lib.MultiTest.run(MultiTest.java:137)
              at nsk.stress.share.StressTest$TestThread.runTest(StressTest.java:742)
              at nsk.stress.share.StressTest$TestThread.run(StressTest.java:755)

      "Thread-308" prio=6 tid=0x4e8dd000 nid=0x1cac8 in Object.wait() [0x4b64e000]
         java.lang.Thread.State: RUNNABLE
              at sun.awt.windows.WToolkit.<clinit>(WToolkit.java:108)
              at java.lang.Class.forName0(Native Method)
              at java.lang.Class.forName(Class.java:186)
              at java.awt.Toolkit$2.run(Toolkit.java:863)
              at java.security.AccessController.doPrivileged(Native Method)
              at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:855)
              - locked <0x05ad5a90> (a java.lang.Class for java.awt.Toolkit)
              at java.awt.Image.getScaledInstance(Image.java:177)
              at javasoft.sqe.tests.api.java.awt.java2d.image.BufferedImage.GetTest.testCase11(GetTest.java:477)
              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:613)
              at javasoft.sqe.jck.lib.MultiTest.run(MultiTest.java:137)
              at nsk.stress.share.StressTest$TestThread.runTest(StressTest.java:742)
              at nsk.stress.share.StressTest$TestThread.run(StressTest.java:755)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                dav Andrei Dmitriev (Inactive)
                Reporter:
                nhaustov Nicolay Haustov (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: