JDK-6789084 : Deadlock when trying to bring up the JFileChooser
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 6
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2008-12-25
  • Updated: 2011-01-19
  • Resolved: 2009-05-15
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
java version "1.6.0_06"
Java(TM) SE Runtime Environment (build 1.6.0_06-b02)
Java HotSpot(TM) Client VM (build 10.0-b22, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]

A DESCRIPTION OF THE PROBLEM :
There is a deadlock when I tried bringing up the JFileChooser.  The symptom is very similar to 6744953 but has a different stack:


Thread [AWT-EventQueue-0] (Suspended)
	owns: Win32ShellFolder2  (id=48)
	owns: Component$AWTTreeLock  (id=54)
	Unsafe.park(boolean, long) line: not available [native method]
	LockSupport.park(Object) line: 158
	FutureTask$Sync(AbstractQueuedSynchronizer).parkAndCheckInterrupt() line: 747
	FutureTask$Sync(AbstractQueuedSynchronizer).doAcquireSharedInterruptibly(int) line: 905
	FutureTask$Sync(AbstractQueuedSynchronizer).acquireSharedInterruptibly(int) line: 1217
	FutureTask$Sync.innerGet() line: 218
	FutureTask<V>.get() line: 83
	Win32ShellFolderManager2$ComInvoker.invoke(Callable<T>) line: 495
	Win32ShellFolder2.hasAttribute(int) line: 520
	Win32ShellFolder2.isLink() line: 737
	WindowsFileSystemView(FileSystemView).isFileSystem(File) line: 281
	WindowsFileSystemView(FileSystemView).getSystemDisplayName(File) line: 155
	BasicFileChooserUI$BasicFileView.getName(File) line: 1157
	JFileChooser.getName(File) line: 1478
	FilePane$FileRenderer.getListCellRendererComponent(JList, Object, int, boolean, boolean) line: 1320
	BasicListUI.updateLayoutState() line: 1342
	BasicListUI.maybeUpdateLayoutState() line: 1292
	BasicListUI.getPreferredSize(JComponent) line: 559
	FilePane$3(JComponent).getPreferredSize() line: 1632
	ScrollPaneLayout$UIResource(ScrollPaneLayout).layoutContainer(Container) line: 769
	JScrollPane(Container).layout() line: 1432
	JScrollPane(Container).doLayout() line: 1421
	JScrollPane(Container).validateTree() line: 1519
	JPanel(Container).validateTree() line: 1526
	FilePane(Container).validateTree() line: 1526
	JFileChooser(Container).validateTree() line: 1526
	JPanel(Container).validateTree() line: 1526
	JLayeredPane(Container).validateTree() line: 1526
	JRootPane(Container).validateTree() line: 1526
	AddBlockTemplateCatalogDialog(Container).validateTree() line: 1526
	AddBlockTemplateCatalogDialog(Container).validate() line: 1491
	AddBlockTemplateCatalogDialog(Window).pack() line: 679
	AddBlockTemplateCatalogDialog(BaseDialog).showDialog(boolean) line: 142
	AddBlockTemplateCatalogAction.actionPerformed(ActionEvent) line: 59
	JButton(AbstractButton).fireActionPerformed(ActionEvent) line: 1995
	AbstractButton$Handler.actionPerformed(ActionEvent) line: 2318
	DefaultButtonModel.fireActionPerformed(ActionEvent) line: 387
	DefaultButtonModel.setPressed(boolean) line: 242
	BasicButtonListener.mouseReleased(MouseEvent) line: 236
	AWTEventMulticaster.mouseReleased(MouseEvent) line: 272
	JButton(Component).processMouseEvent(MouseEvent) line: 6041
	JButton(JComponent).processMouseEvent(MouseEvent) line: 3265
	JButton(Component).processEvent(AWTEvent) line: 5806
	JButton(Container).processEvent(AWTEvent) line: 2058
	JButton(Component).dispatchEventImpl(AWTEvent) line: 4413
	JButton(Container).dispatchEventImpl(AWTEvent) line: 2116
	JButton(Component).dispatchEvent(AWTEvent) line: 4243
	LightweightDispatcher.retargetMouseEvent(Component, int, MouseEvent) line: 4322
	LightweightDispatcher.processMouseEvent(MouseEvent) line: 3986
	LightweightDispatcher.dispatchEvent(AWTEvent) line: 3916
	MainFrame(Container).dispatchEventImpl(AWTEvent) line: 2102
	MainFrame(Window).dispatchEventImpl(AWTEvent) line: 2440
	MainFrame(Component).dispatchEvent(AWTEvent) line: 4243
	EventQueue.dispatchEvent(AWTEvent) line: 599
	EventDispatchThread.pumpOneEventForFilters(int) line: 273
	EventDispatchThread.pumpEventsForFilter(int, Conditional, EventFilter) line: 183
	EventDispatchThread.pumpEventsForHierarchy(int, Conditional, Component) line: 173
	EventDispatchThread.pumpEvents(int, Conditional) line: 168
	EventDispatchThread.pumpEvents(Conditional) line: 160
	EventDispatchThread.run() line: 121


Daemon System Thread [Swing-Shell] (Suspended)
	owns: Vector<E>  (id=49)
	waiting for: Win32ShellFolder2  (id=48)
	Win32ShellFolder2.isFileSystem() line: 510
	Win32ShellFolder2.equals(Object) line: 484
	Vector<E>(AbstractList<E>).equals(Object) line: 507
	Vector<E>.equals(Object) line: 925
	BasicDirectoryModel$LoadFilesThread$1.call() line: 314
	BasicDirectoryModel$LoadFilesThread$1.call() line: 221
	FutureTask$Sync.innerRun() line: 303
	FutureTask<V>.run() line: 138
	ThreadPoolExecutor$Worker.runTask(Runnable) line: 885
	ThreadPoolExecutor$Worker.run() line: 907
	Win32ShellFolderManager2$ComInvoker$3.run() line: 458
	Thread.run() line: 619


Above stacks were taken from inside eclipse debug.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
It seems to be happening more often if I visited a directory with a lot of folders/files once.  Close it and try to reopen it again.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Deadlock inside swing's thread is bad, especially all we're doing is to bring up the JFileChooser.

Looks like the Swing-shell is locking a Vector object (id=49) triggered by a FutureTask.
ACTUAL -
It shouldn't deadlock!

REPRODUCIBILITY :
This bug can be reproduced always.