This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 243747 - DB Explorer calls swing out of EDT causing deadlock
Summary: DB Explorer calls swing out of EDT causing deadlock
Status: RESOLVED FIXED
Alias: None
Product: db
Classification: Unclassified
Component: Code (show other bugs)
Version: 8.0
Hardware: All All
: P3 normal (vote)
Assignee: matthias42
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-10 23:56 UTC by euswdwj
Modified: 2015-02-23 02:24 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 208196


Attachments
stacktrace (4.43 KB, text/plain)
2014-04-10 23:56 UTC, euswdwj
Details
stacktrace (4.43 KB, text/plain)
2014-09-20 08:57 UTC, brettryan
Details
stacktrace (4.43 KB, text/plain)
2015-02-18 09:18 UTC, Jiri Rechtacek
Details

Note You need to log in before you can comment on or make changes to this bug.
Description euswdwj 2014-04-10 23:56:14 UTC
Build: NetBeans IDE 8.0 (Build 201403101706)
VM: Java HotSpot(TM) 64-Bit Server VM, 25.0-b70, Java(TM) SE Runtime Environment, 1.8.0-b132
OS: Mac OS X

User Comments:
GUEST: Importing .grab files

GUEST: importing .grab files to a MySQL database.  The IDE freezes after 1 or 2 files.

GUEST: importing .grab files to a MySQL database

GUEST: Viewing JavaDB Table

GUEST: Made a selection to copy a row in a database table.

euswdwj: recreating table in derby database

GUEST: Problem with Java FX

GUEST: Was attempting to import a grab file into a derby DB.




Stacktrace: 
org.netbeans.modules.deadlock.detector.Detector$DeadlockDetectedException: AWT-EventQueue-0
   at java.awt.Component.invalidate(Component.java:2923)
   at java.awt.Container.invalidate(Container.java:1585)
   at javax.swing.JComponent.revalidate(JComponent.java:4847)
   at javax.swing.JTable.tableRowsInserted(JTable.java:4484)
   at javax.swing.JTable.tableChanged(JTable.java:4409)
   at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:296)
Comment 1 euswdwj 2014-04-10 23:56:16 UTC
Created attachment 146681 [details]
stacktrace
Comment 2 David Strupl 2014-04-17 19:46:40 UTC
IMHO the problem is on line

org.netbeans.modules.db.explorer.action.RecreateTableAction$1.run(RecreateTableAction.java:129)

being called in request processor thread instead of in AWT EDT.

That causes deadlocks.
Comment 3 Libor Fischmeistr 2014-06-06 14:51:56 UTC
I was unable to reproduce.

If somebody had sure steps to reproduce, please write it here.

Also it's not easy to switch it to AWT EDT, cause there is a check on it.
Comment 4 brettryan 2014-09-20 08:57:24 UTC
Created attachment 149385 [details]
stacktrace

Used the "Recreate Table..." function for a h2 database.
Comment 5 Jiri Rechtacek 2015-02-18 09:18:43 UTC
Created attachment 152052 [details]
stacktrace

Deadlock appreared when I invoke Recreate table in DB explorer|Tables node.
Found one Java-level deadlock:
=============================
"Default RequestProcessor":
  waiting to lock monitor 0x00007feacca6f108 (object 0x00000007fe02eec0, a java.lang.Object),
  which is held by "AWT-EventQueue-0"
"AWT-EventQueue-0":
  waiting to lock monitor 0x00007feaca576ed8 (object 0x00000007c0176730, a java.awt.Component$AWTTreeLock),
  which is held by "Default RequestProcessor"

Java stack information for the threads listed above:
===================================================
"Default RequestProcessor":
	at com.apple.laf.AquaFileSystemModel.getRowCount(AquaFileSystemModel.java:194)
	- waiting to lock <0x00000007fe02eec0> (a java.lang.Object)
	at javax.swing.JTable.getRowCount(JTable.java:2662)
	at javax.swing.plaf.basic.BasicTableUI.createTableSize(BasicTableUI.java:1692)
	at javax.swing.plaf.basic.BasicTableUI.getPreferredSize(BasicTableUI.java:1733)
	at javax.swing.JComponent.getPreferredS
Comment 6 matthias42 2015-02-20 22:03:34 UTC
I just pushed this fix:

http://hg.netbeans.org/core-main/rev/80aef89189c9

The stacktraces consistently point to the FileChooser code and indeed the file chooser is invoked outside the EDT. I reworked that code so that the Swing interaction happens on the EDT, while the DB tasks are dispatched off the EDT.

This bug looks like it only affects Mac OS X (all stacktraces lock in com.apple.laf.AquaFileSystemModel.getRowCount) - so while I checked it to still work on linux, please verify on Mac OS X. Thank you!
Comment 7 Quality Engineering 2015-02-23 02:24:56 UTC
Integrated into 'main-silver', will be available in build *201502230001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/80aef89189c9
User: Matthias Blaesing <matthias42@netbeans.org>
Log: #243747: correct swing EDT handling in RecreateTableAction and remove now uncessary helper class