开发者

Strange thread dump on deadlock

开发者 https://www.devze.com 2023-01-16 05:16 出处:网络
We\'v开发者_StackOverflowe been experiencing a strange deadlock during the startup of our java application.When I run jstack on the application to investigate, I see that the AWT-EventQueue is in Obje

We'v开发者_StackOverflowe been experiencing a strange deadlock during the startup of our java application. When I run jstack on the application to investigate, I see that the AWT-EventQueue is in Object.wait(), but the thread is still marked as RUNNABLE. I've included the relevent parts of the thread dump, and I'm hoping that someone can shed some light on this issue.

"AWT-EventQueue-0" prio=6 tid=0x5f0a2400 nid=0x19e4 in Object.wait() [0x6007e000]
       java.lang.Thread.State: RUNNABLE
        at com.ge.med.platinum.work.isu.ExamTransaction.getEAOTableLite(ExamTransaction.java:1514)
          ...
          - locked <0x1fc87448> (a java.awt.Component$AWTTreeLock)
          ...

"Thread-63-Pool-9" prio=6 tid=0x5f1a2800 nid=0x1f54 waiting for monitor entry [0x61a9f000]
   java.lang.Thread.State: BLOCKED (on object monitor)
    at java.awt.Component.setFont(Component.java:1777)
    - waiting to lock <0x1fc87448> (a java.awt.Component$AWTTreeLock)
      ...

"Thread-289-Pool-3" prio=6 tid=0x60afe800 nid=0x12b8 waiting for monitor entry [0x623fe000]
   java.lang.Thread.State: BLOCKED (on object monitor)
    at java.awt.Component.setFont(Component.java:1777)
    - waiting to lock <0x1fc87448> (a java.awt.Component$AWTTreeLock)
      ...

In addition, I've noticed this thread, which mentions that accessing a static variable may be involved. This is also the case in our application. The line in getEAOTableLite in question references a static method.


I'm not sure how I missed it, but if I had read down the stack trace a little better I would have found that the issue was that the static initialization of the EAOAlertManager class would eventaully make a call to the Component.setFont() method, which was be blocked by the AWT-EventQueue (it is illegal to call setFont() outside of the EventQueue). The EventQueue then ended up back in ExamTransaction.getEAOTableLite, which meant that it would reference the EAOAlertManager class again, causing it to wait for the class to finish loading. But the EAOAlertManager class was waiting on the EventQueue. That, my friends, is a deadlock.

"Thread-289-Pool-3" prio=6 tid=0x60afe800 nid=0x12b8 waiting for monitor entry [0x623fe000]
   java.lang.Thread.State: BLOCKED (on object monitor)
    at java.awt.Component.setFont(Component.java:1777)
    - waiting to lock <0x1fc87448> (a java.awt.Component$AWTTreeLock)
    at java.awt.Container.setFont(Container.java:1554)
    at javax.swing.JComponent.setFont(JComponent.java:2723)
    at javax.swing.LookAndFeel.installColorsAndFont(LookAndFeel.java:191)
    at javax.swing.plaf.basic.BasicPanelUI.installDefaults(BasicPanelUI.java:49)
    at javax.swing.plaf.basic.BasicPanelUI.installUI(BasicPanelUI.java:39)
    at com.ge.med.ptk.laf.CuiPanelUI.installUI(CuiPanelUI.java:53)
    at javax.swing.JComponent.setUI(JComponent.java:662)
    at javax.swing.JPanel.setUI(JPanel.java:136)
    at javax.swing.JPanel.updateUI(JPanel.java:109)
    at javax.swing.JPanel.<init>(JPanel.java:69)
    at javax.swing.JPanel.<init>(JPanel.java:92)
    at javax.swing.JPanel.<init>(JPanel.java:100)
    at javax.swing.JRootPane.createGlassPane(JRootPane.java:528)
    at javax.swing.JRootPane.<init>(JRootPane.java:348)
    at javax.swing.JDialog.createRootPane(JDialog.java:611)
    at javax.swing.JDialog.dialogInit(JDialog.java:593)
    at com.ge.med.plaf.wrapper.WJDialog.dialogInit(WJDialog.java:42)
    at javax.swing.JDialog.<init>(JDialog.java:545)
    at javax.swing.JDialog.<init>(JDialog.java:515)
    at com.ge.med.plaf.wrapper.WJDialog.<init>(WJDialog.java:424)
    at com.ge.med.platinum.gui.util.PlatinumDialog.<init>(PlatinumDialog.java:138)
    at com.ge.med.platinum.gui.util.EAOAlertManager$EAOAlertDialog.<init>(EAOAlertManager.java:450)
    at com.ge.med.platinum.gui.util.EAOAlertManager.<clinit>(EAOAlertManager.java:77)
    at com.ge.med.platinum.work.isu.ExamTransaction.getEAOTableLite(ExamTransaction.java:1514)


This article seems to get directly to the point: http://www.javaworld.com/javaworld/jw-04-1999/jw-04-toolbox.html There are 5 pages. I don't know what it all means to your application, but it should help you.

0

精彩评论

暂无评论...
验证码 换一张
取 消