Bug 49708 Deadlock saving compilation unit
It appears there is contention for the lock on the changed compilation unit resulting in the deadlock. The JUnit thread has the lock on the CU and attempts a synchExec. The UI thread is waiting for the lock on the CU. Full thread dump Java HotSpot(TM) Client VM (1.4.2-b28 mixed mode): "Worker-254" prio=5 tid=0x0511c210 nid=0xd08 in Object.wait() [497f000..497fd94] at java.lang.Object.wait(Native Method) at org.eclipse.core.internal.jobs.WorkerPool.sleep(WorkerPool.java:184) - locked <0x124fbd70> (a org.eclipse.core.internal.jobs.WorkerPool) at org.eclipse.core.internal.jobs.WorkerPool.startJob (WorkerPool.java:21 0) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55) "org.eclipse.jdt.internal.ui.text.JavaReconciler" daemon prio=2 tid=0x040d0188 n id=0xe48 in Object.wait() [617f000..617fd94] at java.lang.Object.wait(Native Method) at java.lang.Object.wait(Object.java:429) at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:149) - locked <0x109711f8> (a org.eclipse.swt.widgets.RunnableLock) at org.eclipse.ui.internal.UISynchronizer.syncExec (UISynchronizer.java:2 5) at org.eclipse.swt.widgets.Display.syncExec(Display.java:2628) at org.eclipse.jdt.internal.junit.ui.TestRunnerViewPart.postSyncRunnable (TestRunnerViewPart.java:685) at org.eclipse.jdt.internal.junit.ui.TestRunnerViewPart.codeHasChanged (T estRunnerViewPart.java:1094) at org.eclipse.jdt.internal.junit.ui.TestRunnerViewPart$DirtyListener.pr ocessDelta(TestRunnerViewPart.java:285) at org.eclipse.jdt.internal.junit.ui.TestRunnerViewPart$DirtyListener.el ementChanged(TestRunnerViewPart.java:260) at org.eclipse.jdt.internal.core.DeltaProcessor$2.run (DeltaProcessor.jav a:1388) at org.eclipse.core.internal.runtime.InternalPlatform.run (InternalPlatfo rm.java:813) at org.eclipse.core.runtime.Platform.run(Platform.java:457) at org.eclipse.jdt.internal.core.DeltaProcessor.notifyListeners (DeltaPro cessor.java:1383) at org.eclipse.jdt.internal.core.DeltaProcessor.fireReconcileDelta (Delta Processor.java:1245) at org.eclipse.jdt.internal.core.DeltaProcessor.fire (DeltaProcessor.java :1203) at org.eclipse.jdt.internal.core.JavaModelOperation.run (JavaModelOperati on.java:723) at org.eclipse.jdt.internal.core.JavaElement.runOperation (JavaElement.ja va:524) at org.eclipse.jdt.internal.core.CompilationUnit.reconcile (CompilationUn it.java:1050) at org.eclipse.jdt.internal.core.CompilationUnit.reconcile (CompilationUn it.java:1022) at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconci le(JavaReconcilingStrategy.java:72) - locked <0x177f7f50> (a org.eclipse.jdt.internal.core.CompilationUnit) at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconci le(JavaReconcilingStrategy.java:99) at org.eclipse.jface.text.reconciler.MonoReconciler.process (MonoReconcil er.java:76) at org.eclipse.jface.text.reconciler.AbstractReconciler$BackgroundThread .run(AbstractReconciler.java:189) "Worker-224" prio=5 tid=0x04058e28 nid=0x818 waiting on condition [60ff000..60ff d94] at java.lang.Thread.sleep(Native Method) at org.eclipse.ui.internal.progress.AnimationManager.animateLoop (Animati onManager.java:321) at org.eclipse.ui.internal.progress.AnimationManager$3.run (AnimationMana ger.java:471) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:62) "Java indexing" daemon prio=4 tid=0x00a2fd10 nid=0x1d4 in Object.wait() [387f000 ..387fd94] at java.lang.Object.wait(Native Method) - waiting on <0x126d3d70> (a org.eclipse.jdt.internal.core.search.indexi ng.IndexManager) at java.lang.Object.wait(Object.java:429) at org.eclipse.jdt.internal.core.search.processing.JobManager.run (JobMan ager.java:327) - locked <0x126d3d70> (a org.eclipse.jdt.internal.core.search.indexing.I ndexManager) at java.lang.Thread.run(Thread.java:534) "Start Level Event Dispatcher" daemon prio=5 tid=0x00a478c0 nid=0xae4 in Object. wait() [307f000..307fd94] at java.lang.Object.wait(Native Method) - waiting on <0x124f0128> (a org.eclipse.osgi.framework.eventmgr.EventTh read) at java.lang.Object.wait(Object.java:429) at org.eclipse.osgi.framework.eventmgr.EventThread.getNextEvent (EventThr ead.java:169) - locked <0x124f0128> (a org.eclipse.osgi.framework.eventmgr.EventThread ) at org.eclipse.osgi.framework.eventmgr.EventThread.run (EventThread.java: 120) "Framework Event Dispatcher" daemon prio=5 tid=0x00a4ce78 nid=0x938 in Object.wa it() [303f000..303fd94] at java.lang.Object.wait(Native Method) - waiting on <0x124f0178> (a org.eclipse.osgi.framework.eventmgr.EventTh read) at java.lang.Object.wait(Object.java:429) at org.eclipse.osgi.framework.eventmgr.EventThread.getNextEvent (EventThr ead.java:169) - locked <0x124f0178> (a org.eclipse.osgi.framework.eventmgr.EventThread ) at org.eclipse.osgi.framework.eventmgr.EventThread.run (EventThread.java: 120) "Signal Dispatcher" daemon prio=10 tid=0x0003d408 nid=0x91c waiting on condition [0..0] "Finalizer" daemon prio=9 tid=0x009c0120 nid=0xa68 in Object.wait() [2ccf000..2c cfd94] at java.lang.Object.wait(Native Method) at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:111) - locked <0x124f02a0> (a java.lang.ref.ReferenceQueue$Lock) at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:127) at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159) "Reference Handler" daemon prio=10 tid=0x009becf0 nid=0x7a8 in Object.wait() [2c 8f000..2c8fd94] at java.lang.Object.wait(Native Method) at java.lang.Object.wait(Object.java:429) at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:115) - locked <0x124f0308> (a java.lang.ref.Reference$Lock) "main" prio=7 tid=0x00035260 nid=0x348 waiting for monitor entry [7f000..7fc3c] at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor$MouseClickListener. getCurrentTextRegion(JavaEditor.java:544) - waiting to lock <0x177f7f50> (a org.eclipse.jdt.internal.core.Compilat ionUnit) at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor$MouseClickListener. mouseMove(JavaEditor.java:771) at org.eclipse.swt.widgets.TypedListener.handleEvent (TypedListener.java: 144) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:847) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2311) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1992) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1506) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1482) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench (Workbench.jav a:246) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:139) at org.eclipse.ui.internal.ide.IDEApplication.run (IDEApplication.java:47 ) at org.eclipse.core.internal.runtime.PlatformActivator$1.run (PlatformAct ivator.java:226) at org.eclipse.core.runtime.adaptor.EclipseStarter.run (EclipseStarter.ja va:85) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl. java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAcces sorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:279) at org.eclipse.core.launcher.Main.run(Main.java:742) at org.eclipse.core.launcher.Main.main(Main.java:581) "VM Thread" prio=5 tid=0x009fb6e8 nid=0xad8 runnable "VM Periodic Task Thread" prio=10 tid=0x0003fb58 nid=0xb40 waiting on condition "Suspend Checker Thread" prio=10 tid=0x009c2590 nid=0x924 runnable
org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/ui/TestRunnerViewPart.java
/*******************************************************************************
 * Copyright (c) 2000, 2003 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials 
 * are made available under the terms of the Common Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/cpl-v10.html
 * 
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *     Julien Ruaux: jruaux@octo.com see bug 25324 Ability to know when tests are finished [junit]
 *     Vincent Massol: vmassol@octo.com 25324 Ability to know when tests are finished [junit]
 *     Sebastian Davids: sdavids@gmx.de 35762 JUnit View wasting a lot of screen space [JUnit]
 ******************************************************************************/
package org.eclipse.jdt.internal.junit.ui;
import java.net.MalformedURLException;
import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;