Project: JDT
Bug 112217 [implementation] Deadlock in ASTProvider.getAST
Reported: 2005-10-11 10:40:24 | Status: verified fixed

Eclipse 3.2M2 + Mylar for 3.2 0.3.11 I tried to copy and paste some code in the Java editor and Eclipse locked up. I managed to get a stack trace which is pasted below. Full thread dump Java HotSpot(TM) Client VM (1.5.0_02-b09 mixed mode, sharing): "Text Viewer Hover Presenter" daemon prio=2 tid=0x0305cd30 nid=0x5b4 in Object.wait() [0x0350f000..0x0350fce8] at java.lang.Object.wait(Native Method) - waiting on <0x1835ec98> (a java.lang.Object) at java.lang.Object.wait(Object.java:474) at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.getAST(ASTProvider.java:470) - locked <0x1835ec98> (a java.lang.Object) at org.eclipse.jdt.internal.ui.text.java.hover.NLSStringHover.getHoverInfo(NLSStringHover.java:84) at org.eclipse.jdt.internal.ui.text.java.hover.BestMatchHover.getHoverInfo(BestMatchHover.java:102) at org.eclipse.jdt.internal.ui.text.java.hover.JavaEditorTextHoverProxy.getHoverInfo(JavaEditorTextHoverProxy.java:69) at org.eclipse.jface.text.TextViewerHoverManager$4.run(TextViewerHoverManager.java:160) "Worker-11" prio=5 tid=0x04cb0e68 nid=0xe58 in Object.wait() [0x05adf000..0x05adfc68] at java.lang.Object.wait(Native Method) - waiting on <0x17f76b10> (a org.eclipse.core.internal.jobs.WorkerPool) at org.eclipse.core.internal.jobs.WorkerPool.sleep(WorkerPool.java:173) - locked <0x17f76b10> (a org.eclipse.core.internal.jobs.WorkerPool) at org.eclipse.core.internal.jobs.WorkerPool.startJob(WorkerPool.java:205) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:69) "Worker-9" prio=5 tid=0x042a82e0 nid=0x54c in Object.wait() [0x04a0f000..0x04a0fd68] at java.lang.Object.wait(Native Method) - waiting on <0x1835ec98> (a java.lang.Object) at java.lang.Object.wait(Object.java:474) at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.getAST(ASTProvider.java:470) - locked <0x1835ec98> (a java.lang.Object) at org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$PartListenerGroup.calculateASTandInform(SelectionListenerWithASTManager.java:165) at org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$3.run(SelectionListenerWithASTManager.java:142) - locked <0x18b59468> (a java.lang.Object) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:76) "Worker-8" prio=5 tid=0x03fdb450 nid=0x21e8 waiting for monitor entry [0x0457f000..0x0457f9e8] at org.eclipse.jdt.internal.ui.viewsupport.SelectionListenerWithASTManager$3.run(SelectionListenerWithASTManager.java:142) - waiting to lock <0x18b59468> (a java.lang.Object) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:76) "org.eclipse.jdt.internal.ui.text.JavaReconciler" daemon prio=2 tid=0x03f49d08 nid=0x236c in Object.wait() [0x03d0f000..0x03d0f9e8] at java.lang.Object.wait(Native Method) - waiting on <0x19259a48> (a org.eclipse.jface.text.reconciler.DirtyRegionQueue) at org.eclipse.jface.text.reconciler.AbstractReconciler$BackgroundThread.run(AbstractReconciler.java:176) - locked <0x19259a48> (a org.eclipse.jface.text.reconciler.DirtyRegionQueue) "org.eclipse.jdt.internal.ui.text.JavaReconciler" daemon prio=2 tid=0x03eef040 nid=0x2880 in Object.wait() [0x0485f000..0x0485fd68] at java.lang.Object.wait(Native Method) - waiting on <0x18f3b390> (a org.eclipse.jface.text.reconciler.DirtyRegionQueue) at org.eclipse.jface.text.reconciler.AbstractReconciler$BackgroundThread.run(AbstractReconciler.java:176) - locked <0x18f3b390> (a org.eclipse.jface.text.reconciler.DirtyRegionQueue) "org.eclipse.jdt.internal.ui.text.JavaReconciler" daemon prio=2 tid=0x03eb5d50 nid=0x754 in Object.wait() [0x046ff000..0x046ffbe8] at java.lang.Object.wait(Native Method) - waiting on <0x18da8fa0> (a org.eclipse.jface.text.reconciler.DirtyRegionQueue) at org.eclipse.jface.text.reconciler.AbstractReconciler$BackgroundThread.run(AbstractReconciler.java:176) - locked <0x18da8fa0> (a org.eclipse.jface.text.reconciler.DirtyRegionQueue) "org.eclipse.jdt.internal.ui.text.JavaReconciler" daemon prio=2 tid=0x040a5988 nid=0x1188 in Object.wait() [0x0477f000..0x0477fc68] at java.lang.Object.wait(Native Method) - waiting on <0x18af7818> (a org.eclipse.jface.text.reconciler.DirtyRegionQueue) at org.eclipse.jface.text.reconciler.AbstractReconciler$BackgroundThread.run(AbstractReconciler.java:176) - locked <0x18af7818> (a org.eclipse.jface.text.reconciler.DirtyRegionQueue) "Thread-3" prio=7 tid=0x033097f8 nid=0x1a40 waiting on condition [0x0466f000..0x0466fb68] at java.lang.Thread.sleep(Native Method) at org.eclipse.mylar.core.internal.ActivityTimerThread.run(ActivityTimerThread.java:58) "Thread-2" prio=7 tid=0x02f54cd0 nid=0x2dd4 waiting on condition [0x03ccf000..0x03ccf9e8] at java.lang.Thread.sleep(Native Method) at org.eclipse.mylar.core.internal.ActivityTimerThread.run(ActivityTimerThread.java:58) "Java indexing" daemon prio=4 tid=0x00a66038 nid=0x1328 in Object.wait() [0x03c5f000..0x03c5fa68] at java.lang.Object.wait(Native Method) - waiting on <0x18296180> (a org.eclipse.jdt.internal.core.search.indexing.IndexManager) at java.lang.Object.wait(Object.java:474) at org.eclipse.jdt.internal.core.search.processing.JobManager.run(JobManager.java:349) - locked <0x18296180> (a org.eclipse.jdt.internal.core.search.indexing.IndexManager) at java.lang.Thread.run(Thread.java:595) "Start Level Event Dispatcher" daemon prio=5 tid=0x02d466d0 nid=0x2c7c in Object.wait() [0x0343f000..0x0343fce8] at java.lang.Object.wait(Native Method) - waiting on <0x17e53ab0> (a org.eclipse.osgi.framework.eventmgr.EventManager$EventThread) at java.lang.Object.wait(Object.java:474) at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.getNextEvent(EventManager.java:349) - locked <0x17e53ab0> (a org.eclipse.osgi.framework.eventmgr.EventManager$EventThread) at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:287) "Framework Event Dispatcher" daemon prio=5 tid=0x02ff8008 nid=0x2cdc in Object.wait() [0x033ff000..0x033ffd68] at java.lang.Object.wait(Native Method) - waiting on <0x17e53ba8> (a org.eclipse.osgi.framework.eventmgr.EventManager$EventThread) at java.lang.Object.wait(Object.java:474) at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.getNextEvent(EventManager.java:349) - locked <0x17e53ba8> (a org.eclipse.osgi.framework.eventmgr.EventManager$EventThread) at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:287) "State Data Manager" daemon prio=5 tid=0x02d35968 nid=0x23b8 waiting on condition [0x033bf000..0x033bf9e8] at java.lang.Thread.sleep(Native Method) at org.eclipse.osgi.framework.adaptor.core.StateManager.run(StateManager.java:310) at java.lang.Thread.run(Thread.java:595) "Low Memory Detector" daemon prio=5 tid=0x00a6d4d8 nid=0x283c runnable [0x00000000..0x00000000] "CompilerThread0" daemon prio=10 tid=0x00a6c1e0 nid=0xd98 waiting on condition [0x00000000..0x02c9f840] "Signal Dispatcher" daemon prio=10 tid=0x00a6b3a0 nid=0x774 waiting on condition [0x00000000..0x00000000] "Finalizer" daemon prio=9 tid=0x00a68818 nid=0x3120 in Object.wait() [0x02c1f000..0x02c1fc68] at java.lang.Object.wait(Native Method) - waiting on <0x17e202d8> (a java.lang.ref.ReferenceQueue$Lock) at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:116) - locked <0x17e202d8> (a java.lang.ref.ReferenceQueue$Lock) at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:132) at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159) "Reference Handler" daemon prio=10 tid=0x00a39dd8 nid=0x9b8 in Object.wait() [0x02bdf000..0x02bdfce8] at java.lang.Object.wait(Native Method) - waiting on <0x17e20060> (a java.lang.ref.Reference$Lock) at java.lang.Object.wait(Object.java:474) at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:116) - locked <0x17e20060> (a java.lang.ref.Reference$Lock) "main" prio=7 tid=0x00035cc0 nid=0x16e0 in Object.wait() [0x0007e000..0x0007fc3c] at java.lang.Object.wait(Native Method) - waiting on <0x1835ec98> (a java.lang.Object) at java.lang.Object.wait(Object.java:474) at org.eclipse.jdt.internal.ui.javaeditor.ASTProvider.getAST(ASTProvider.java:470) - locked <0x1835ec98> (a java.lang.Object) at org.eclipse.jdt.internal.ui.javaeditor.ClipboardOperationAction.getClipboardData(ClipboardOperationAction.java:393) at org.eclipse.jdt.internal.ui.javaeditor.ClipboardOperationAction.doCutCopyWithImportsOperation(ClipboardOperationAction.java:322) at org.eclipse.jdt.internal.ui.javaeditor.ClipboardOperationAction.internalDoOperation(ClipboardOperationAction.java:278) at org.eclipse.jdt.internal.ui.javaeditor.ClipboardOperationAction$1.run(ClipboardOperationAction.java:247) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69) at org.eclipse.jdt.internal.ui.javaeditor.ClipboardOperationAction.run(ClipboardOperationAction.java:245) at org.eclipse.jface.action.Action.runWithEvent(Action.java:996) at org.eclipse.ui.commands.ActionHandler.execute(ActionHandler.java:182) at org.eclipse.ui.internal.handlers.LegacyHandlerWrapper.execute(LegacyHandlerWrapper.java:108) at org.eclipse.core.commands.Command.execute(Command.java:311) at org.eclipse.core.commands.ParameterizedCommand.execute(ParameterizedCommand.java:397) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.executeCommand(WorkbenchKeyboard.java:459) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.press(WorkbenchKeyboard.java:781) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.processKeyEvent(WorkbenchKeyboard.java:828) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.filterKeySequenceBindings(WorkbenchKeyboard.java:550) at org.eclipse.ui.internal.keys.WorkbenchKeyboard.access$3(WorkbenchKeyboard.java:493) at org.eclipse.ui.internal.keys.WorkbenchKeyboard$KeyDownFilter.handleEvent(WorkbenchKeyboard.java:117) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Display.filterEvent(Display.java:971) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:883) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:908) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:893) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:921) at org.eclipse.swt.widgets.Widget.sendKeyEvent(Widget.java:917) at org.eclipse.swt.widgets.Widget.wmChar(Widget.java:1231) at org.eclipse.swt.widgets.Control.WM_CHAR(Control.java:3157) at org.eclipse.swt.widgets.Control.windowProc(Control.java:3058) at org.eclipse.swt.widgets.Display.windowProc(Display.java:3830) at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method) at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1679) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2821) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1755) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1719) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:368) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:106) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:226) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:377) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:164) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.eclipse.core.launcher.Main.invokeFramework(Main.java:338) at org.eclipse.core.launcher.Main.basicRun(Main.java:282) at org.eclipse.core.launcher.Main.run(Main.java:977) at org.eclipse.core.launcher.Main.main(Main.java:952) "VM Thread" prio=10 tid=0x00a67a98 nid=0x3174 runnable "VM Periodic Task Thread" prio=10 tid=0x00a6e858 nid=0x1150 waiting on condition

Files changed in fix:
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/ASTProvider.java