Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: thread deadlock on Mac Intel under apple.laf.AquaDirectoryModel



A lot of people run into this.  This is due to the fact that you are executing UI code on the wrong thread.  The general rules are that once the UI is "realized" you need to execute UI code on the AWT Event Queue thread.  When a UI is "realized" is sometimes mysterious.  The best thing to do is always use SwingUtilities.invokeLater to ensure you execute on the right thread.

As you noticed in the release notes changes were made in the file chooser implementation to try to alleviate some of these problems (not necessarily the one you are running into) since a lot of people run into this.  However when it comes down to it you really need to update your code to safegaurd you from these threading situations.

I hope that helps

Josh

On 3/20/06, Jim Davidson <email@hidden> wrote:
My Java app is hitting thread deadlock on Mac Intel.  This does not
happen with any other platform, including PPC.  On Mac Intel, it happens
with 1.4.2, and the released version of 1.5.  It does *not* happen with
the latest DP (J2SE 5.0 R4 DP6).

Here's a part of the thread dump:

"AWT-EventQueue-1" prio=6 tid=0x005147a0 nid=0x1975c00 waiting for monitor
entry [0xb0f88000..0xb0f88d10]
        at java.awt.Component.invalidate (Component.java:2427)
        - waiting to lock <0x083d1ff8> (a java.awt.Component$AWTTreeLock)
        at java.awt.Container.invalidate(Container.java:1419)
        at javax.swing.JComponent.revalidate(JComponent.java :4573)
        at javax.swing.JTable.tableRowsInserted(JTable.java:3097)
        at javax.swing.JTable.tableChanged(JTable.java:3020)
        at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java :280)
        at javax.swing.table.AbstractTableModel.fireTableRowsInserted(AbstractTableModel.java:215)
        at apple.laf.AquaDirectoryModel$DoChangeContents.run(AquaDirectoryModel.java:447)
        - locked <0x06651188> (a java.lang.Object)
        - locked <0x06687ca8> (a java.lang.Object)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java :461)
           .............

"Module-Actions" daemon prio=1 tid=0x0054a030 nid=0x1a47400 waiting for monitor entry [0xb130e000..0xb130fd10]
        at apple.laf.AquaDirectoryModel.getRowCount(AquaDirectoryModel.java :184)
        - waiting to lock <0x06651188> (a java.lang.Object)
        at javax.swing.JTable.getRowCount(JTable.java:1797)
        at javax.swing.plaf.basic.BasicTableUI.createTableSize(BasicTableUI.java :1694)
        at javax.swing.plaf.basic.BasicTableUI.getPreferredSize(BasicTableUI.java:1735)
        at javax.swing.JComponent.getPreferredSize(JComponent.java:1615)
        at javax.swing.JViewport.getViewSize (JViewport.java:1001)
        at javax.swing.ScrollPaneLayout.preferredLayoutSize(ScrollPaneLayout.java:476)
        at java.awt.Container.preferredSize(Container.java:1558)
        - locked <0x083d1ff8> (a java.awt.Component$AWTTreeLock)
        at java.awt.Container.getPreferredSize(Container.java:1543)
        at javax.swing.JComponent.getPreferredSize(JComponent.java:1617)
        at java.awt.BorderLayout.preferredLayoutSize (BorderLayout.java:690)
        - locked <0x083d1ff8> (a java.awt.Component$AWTTreeLock)
        at java.awt.Container.preferredSize(Container.java:1558)
        - locked <0x083d1ff8> (a java.awt.Component$AWTTreeLock )
        at java.awt.Container.getPreferredSize(Container.java:1543)
        at javax.swing.JComponent.getPreferredSize(JComponent.java:1617)
        at java.awt.BorderLayout.preferredLayoutSize(BorderLayout.java :690)
        .......................

Found one Java-level deadlock:
=============================
"Module-Actions":
  waiting to lock monitor 0x0180f1b4 (object 0x06651188, a java.lang.Object ),
  which is held by "AWT-EventQueue-1"
"AWT-EventQueue-1":
  waiting to lock monitor 0x0180f100 (object 0x083d1ff8, a java.awt.Component$AWTTreeLock),
  which is held by "Module-Actions"

I notice that both stack traces contain AquaDirectoryModel.  I'm
guessing that's the source of the problem, since this doesn't occur on
any other platform.  This seems to be similar to the problem reported
in: <http://tykje.com/unpackingjavamustangonosx>

Looking at the release notes for the various DPs, there's nothing about
bugfixes in AquaDirectoryModel, but DP5 reported a fix:
        "( 4400344 ) Application deadlocks in JTable"
But, this isn't enough information to determine whether the bug
was the same.

Has anyone else seen this?  Maybe some docs on the AquaDirectoryModel
class?  A list search didn't turn up anything.  I'm hoping to find a
workaround, since there's presently no released version of Java that
this works on.

-Jim
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden

References: 
 >thread deadlock on Mac Intel under apple.laf.AquaDirectoryModel (From: Jim Davidson <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.