Community
Participate
Working Groups
I am not able to finish cdt.ui unit tests ever. Here is relevant stack: Thread [Worker-4] (Suspended) ProjectPreferences(EclipsePreferences).getChild(String, Object, boolean) line: 400 <- blocked on 'this' instance of IEclipsePreferences ProjectPreferences(EclipsePreferences).internalNode(String, boolean, Object) line: 542 ProjectPreferences(EclipsePreferences).node(String) line: 670 IndexerPreferences.getProjectPreferences(IProject) line: 307 IndexerPreferences.addChangeListener(IProject, IEclipsePreferences$IPreferenceChangeListener) line: 351 PDOMManager.registerPreferenceListener(ICProject) line: 769 PDOMManager.registerIndexer(ICProject, IPDOMIndexer) line: 515 PDOMManager.createIndexer(ICProject, IProgressMonitor) line: 562 <-- Holds the lock on fUpdatePolicies PDOMSetupJob.run(IProgressMonitor) line: 58 Worker.run() line: 54 Thread [main] (Suspended) PDOMManager.getIndexer(ICProject) line: 522 <-- blocked on fUpdatePolicies PDOMManager.changeProject(ICProject, ITranslationUnit[], ITranslationUnit[], ITranslationUnit[]) line: 782 CModelListener.elementChanged(ElementChangedEvent) line: 70 CModelManager$1.run() line: 1101 SafeRunner.run(ISafeRunnable) line: 42 CModelManager.notifyListeners(ICElementDelta, int, IElementChangedListener[], int[], int) line: 1094 CModelManager.firePostChangeDelta(ICElementDelta, IElementChangedListener[], int[], int) line: 1051 CModelManager.fire(ICElementDelta, int) line: 1016 CModelManager.fire(int) line: 973 CModelManager.resourceChanged(IResourceChangeEvent) line: 892 NotificationManager$1.run() line: 291 SafeRunner.run(ISafeRunnable) line: 42 NotificationManager.notify(ResourceChangeListenerList$ListenerEntry[], IResourceChangeEvent, boolean) line: 285 NotificationManager.broadcastChanges(ElementTree, ResourceChangeEvent, boolean) line: 149 Workspace.broadcastPostChange() line: 395 Workspace.endOperation(ISchedulingRule, boolean, IProgressMonitor) line: 1530 Workspace.run(IWorkspaceRunnable, ISchedulingRule, int, IProgressMonitor) line: 2353 ProjectPreferences.save() line: 628 ProjectPreferences(EclipsePreferences).flush() line: 353 <-- Holds lock 'this', instance of IEclipsePreferences ProjectPreferences.flush() line: 380 CProject.setOption(String, String) line: 313 FormatActionTest$FormatTestSetup.setUp() line: 60 TestSetup$1.protect() line: 22 TestResult.runProtected(Test, Protectable) line: 128 FormatActionTest$FormatTestSetup(TestSetup).run(TestResult) line: 27 SuiteMethod(JUnit38ClassRunner).run(RunNotifier) line: 83 JUnit4TestClassReference(JUnit4TestReference).run(TestExecution) line: 50 TestExecution.run(ITestReference[]) line: 38 RemotePluginTestRunner(RemoteTestRunner).runTests(String[], String, TestExecution) line: 467 RemotePluginTestRunner(RemoteTestRunner).runTests(TestExecution) line: 683 RemotePluginTestRunner(RemoteTestRunner).run() line: 390 RemotePluginTestRunner.main(String[]) line: 62 PlatformUITestHarness$1.run() line: 47 RunnableLock.run() line: 35 UISynchronizer(Synchronizer).runAsyncMessages(boolean) line: 135 Display.runAsyncMessages(boolean) line: 4140 Display.readAndDispatch() line: 3757 Workbench.runEventLoop(Window$IExceptionHandler, Display) line: 2696 Workbench.runUI() line: 2660 Workbench.access$4(Workbench) line: 2494 Workbench$7.run() line: 674 Realm.runWithDefault(Realm, Runnable) line: 332 Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 667 PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 149 IDEApplication.start(IApplicationContext) line: 123 UITestApplication(NonUIThreadTestApplication).runApp(Object, IApplicationContext, String[]) line: 54 UITestApplication.runApp(Object, IApplicationContext, String[]) line: 41 UITestApplication(NonUIThreadTestApplication).start(IApplicationContext) line: 48 EclipseAppHandle.run(Object) line: 196 EclipseAppLauncher.runApplication(Object) line: 110 EclipseAppLauncher.start(Object) line: 79 EclipseStarter.run(Object) line: 344 EclipseStarter.run(String[], Runnable) line: 179 NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method] NativeMethodAccessorImpl.invoke(Object, Object[]) line: not available DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: not available Method.invoke(Object, Object...) line: not available Main.invokeFramework(String[], URL[]) line: 622 Main.basicRun(String[]) line: 577 Main.run(String[]) line: 1410 Main.main(String[]) line: 1386
(In reply to comment #0) > I am not able to finish cdt.ui unit tests ever. Here is relevant stack: Note that the stack is actually for tag CDT_8_0 - CDT 8.0 final.
The method org.eclipse.core.internal.preferences.EclipsePreferences.flush() is now synchronized in 3.7.1, this is why we are seeing a deadlock now.
From what I understand, even if a CProject is created without index (IPDOMManager.ID_NO_INDEXER) the PDOMSetupJob runs and gets a lock on fUpdatePolicies then preferences. Before that finishes, a call to setOption locks preferences then the changes to preferences triggers a call to getIndexer which locks fUpdatePolicies. I tried adding a bunch of joinIndexer calls right after creating a project in AddBlockCommentTest, FormatActionTest, RemoveBlockCommentTest, ShiftActionTest. But even doing that I get an occasional deadlock and it seems wrong to me to have to joinIndexer for projects configured with IPDOMManager.ID_NO_INDEXER.
See bug 351231 for synchronized change.
While it may be possible to find a workaround in CDT, I think the real problem is the new "synchronized" method in equinox.preferences. Due to Open Calls form inside the synchronized block, others may deadlock too. I have filed bug 359698 asking Equinox to fix the regression.
(In reply to comment #3) > From what I understand, even if a CProject is created without index > (IPDOMManager.ID_NO_INDEXER) the PDOMSetupJob runs It sounds that we should avoid running the job if no indexer is assigned. Sounds like right thing to do even if we may want to wait out for the preferences bug to get fixed.
(In reply to comment #6) I provided a workaround.
*** cdt git genie on behalf of Markus Schorn *** Bug 359485: Workaround deadlock with preferences. [*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=2ac81668e38d623ebe7d5b9439a5dbd20a020790
*** cdt git genie on behalf of Markus Schorn *** Bug 359485: Workaround deadlock with preferences. [*] http://git.eclipse.org/c/cdt/org.eclipse.cdt.git/commit/?id=242b783c8c4d32d13409ce099c72126ec7d24648
What are the steps/locations to load and run the CDT test versions that showed this failure? I have a patch for the core that I'd like to test. Thanks.
(In reply to comment #10) > What are the steps/locations to load and run the CDT test versions that showed > this failure? I have a patch for the core that I'd like to test. Thanks. - Before you run the tests, I suggest to install CDT first from Indigo update site or download from http://download.eclipse.org/tools/cdt/builds/8.0.0/index.html (I recommend that). Our unit tests may have implicit dependencies which are hard to track. Not sure whether you may need gcc in your path, probably it's OK for cdt.ui not to have it. Install everything except "C++ Remote Launch" and "Target Communication Framework" not to pull some extra 3-rd party plugins. - CDT repository is ssh://user@git.eclipse.org/gitroot/cdt/org.eclipse.cdt.git. - Clone it, check out tag CDT_8_0 and import core/org.eclipse.cdt.ui.tests project. - Find ui/org.eclipse.cdt.ui.tests.text/TextTestSuite.java and Run/Debug as JUnit Plugin Test. Note that deadlock is happening intermittently, in this bug FormatActionTest is reported. For me, it locked up most often in testBugs test. - Don't be too impatient, some tests may take some seconds to run but normally a test shouldn't take more than 30 sec.
Cool, thanks for the detailed steps. I am able to check out the tests and run them.
This was fixed, closing.
For platform 3.8 we still rely on the workaround. The workaround itself needs to be removed before closing this bug.
The workaround is not needed (I have tested it) with platform 3.7.2 or 3.8m6. I have removed the workaround for 8.1 and on the 8.0.x stream post 8.0.2. Note: The combination CDT 8.0.2 with platform 3.7.2 contains both the platform fix and the workaround which causes bug 375601.