JDK-7177040 : Deadlock between PostEventQueue.noEvents, EventQueue.isDispatchThread and SwingUtilities.invokeLater
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 7,7u4
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: linux,os_x,windows_7
  • CPU: x86
  • Submitted: 2012-06-14
  • Updated: 2013-09-06
  • Resolved: 2012-08-31
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7 JDK 8
7u10Fixed 8Fixed
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
Description
The following deadlock has been encountered when starting NetBeans on Java 7 on Windows 7. Full thread dump is also attached to this bug report.

"Indexer Cache":
	at sun.misc.Unsafe.park(Native Method)
	- parking to wait for  <0x00000000d0040460> (a java.util.concurrent.locks.ReentrantLock$NonfairSync)
	at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:834)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(AbstractQueuedSynchronizer.java:867)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:1197)
	at java.util.concurrent.locks.ReentrantLock$NonfairSync.lock(ReentrantLock.java:214)
	at java.util.concurrent.locks.ReentrantLock.lock(ReentrantLock.java:290)
	at java.awt.EventQueue.isDispatchThreadImpl(EventQueue.java:989)
	at java.awt.EventQueue.isDispatchThread(EventQueue.java:984)
	at javax.swing.SwingUtilities.isEventDispatchThread(SwingUtilities.java:1359)
	at org.netbeans.modules.maven.j2ee.web.WebCopyOnSave$FileListenerImpl.fileChanged(WebCopyOnSave.java:154)
	at org.openide.filesystems.FCLSupport$DispatchEventWrapper.dispatchEventImpl(FCLSupport.java:145)
	at org.openide.filesystems.FCLSupport$DispatchEventWrapper.dispatchEvent(FCLSupport.java:128)
	at org.openide.filesystems.FCLSupport.dispatchEvent(FCLSupport.java:105)
	at org.openide.filesystems.FileObject$ED.dispatch(FileObject.java:1280)
	at org.openide.filesystems.FileSystem$EventDispatcher.run(FileSystem.java:997)
	at org.openide.filesystems.EventControl.dispatchEvent(EventControl.java:84)
	at org.openide.filesystems.FileSystem.dispatchEvent(FileSystem.java:642)
	at org.openide.filesystems.FileObject.dispatchEvent(FileObject.java:564)
	at org.openide.filesystems.FileObject.fireFileChangedEvent(FileObject.java:532)
	at org.netbeans.modules.masterfs.filebasedfs.fileobjects.BaseFileObj.fireFileChangedEvent(BaseFileObj.java:672)
	at org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObj$1.close(FileObj.java:137)
	at java.io.FilterOutputStream.close(FilterOutputStream.java:160)
	at org.openide.filesystems.FileObject$1.close(FileObject.java:747)
	at org.netbeans.modules.parsing.impl.indexing.IndexerCache.writeLastKnownIndexers(IndexerCache.java:618)
	at org.netbeans.modules.parsing.impl.indexing.IndexerCache.getData(IndexerCache.java:428)
	- locked <0x00000000d0c7ccd0> (a org.netbeans.modules.parsing.impl.indexing.IndexerCache$1)
	at org.netbeans.modules.parsing.impl.indexing.IndexerCache.access$400(IndexerCache.java:88)
	at org.netbeans.modules.parsing.impl.indexing.IndexerCache$3.run(IndexerCache.java:455)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1452)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2032)
"AWT-EventQueue-1":
	at sun.awt.PostEventQueue.noEvents(SunToolkit.java:2104)
	- waiting to lock <0x00000000d048a490> (a sun.awt.PostEventQueue)
	at sun.awt.SunToolkit.isPostEventQueueEmpty(SunToolkit.java:577)
	at java.awt.EventQueue.detachDispatchThread(EventQueue.java:1048)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:103)
"TimerQueue":
	at sun.misc.Unsafe.park(Native Method)
	- parking to wait for  <0x00000000d0040460> (a java.util.concurrent.locks.ReentrantLock$NonfairSync)
	at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:834)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(AbstractQueuedSynchronizer.java:867)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:1197)
	at java.util.concurrent.locks.ReentrantLock$NonfairSync.lock(ReentrantLock.java:214)
	at java.util.concurrent.locks.ReentrantLock.lock(ReentrantLock.java:290)
	at java.awt.EventQueue.postEventPrivate(EventQueue.java:235)
	at java.awt.EventQueue.postEvent(EventQueue.java:221)
	at sun.awt.PostEventQueue.flush(SunToolkit.java:2116)
	- locked <0x00000000d048a490> (a sun.awt.PostEventQueue)
	at sun.awt.SunToolkit.flushPendingEvents(SunToolkit.java:563)
	at java.awt.EventQueue.postEvent(EventQueue.java:220)
	at java.awt.EventQueue.invokeLater(EventQueue.java:1188)
	at javax.swing.SwingUtilities.invokeLater(SwingUtilities.java:1287)
	at javax.swing.Timer$1.run(Timer.java:613)
	at javax.swing.Timer$1.run(Timer.java:611)
	at java.security.AccessController.doPrivileged(Native Method)
	at javax.swing.Timer.post(Timer.java:611)
	at javax.swing.TimerQueue.run(TimerQueue.java:181)
	at java.lang.Thread.run(Thread.java:722)

Found 1 deadlock.

Original NetBeans bug:
http://netbeans.org/bugzilla/show_bug.cgi?id=213926

Comments
EVALUATION http://hg.openjdk.java.net/hsx/hotspot-comp/jdk/rev/08842f8ce960
14-08-2012

EVALUATION To eliminate deadlock concurrent access to EventQueue.pushPopLock and PostEventQueue (as synchronization objects) should be resolved. Two ways: 1. Fix the sequenece of locks between threads 2. Make one common synchronization object.
03-07-2012