Bug 184466 - UI Jobs refer to deleted projects in the ui tests
Summary: UI Jobs refer to deleted projects in the ui tests
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-core (show other bugs)
Version: 4.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 4.0 M7   Edit
Assignee: Anton Leherbauer CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2007-04-27 11:57 EDT by Jason Montojo CLA
Modified: 2008-06-20 11:26 EDT (History)
2 users (show)

See Also:


Attachments
Patch to expose race condition (1.43 KB, patch)
2007-04-27 11:58 EDT, Jason Montojo CLA
bjorn.freeman-benson: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jason Montojo CLA 2007-04-27 11:57:00 EDT
I'm assuming that CoreModel should never return a null ICProjectDescription for a valid ICProject.

I had to put in a workaround in changes I did for bug 151850 because I was getting a null ICProjectDescription from CoreModel when I looked up the active configuration for a project.  Without that workaround, some of the UI tests randomly failed.

I'm attaching a patch here that detects when a null ICProjectDescription is returned by CoreModel.  This will cause some UI tests to randomly fail when AutomatedSuite is run as a whole.  When the failed tests are individually run, they pass.

Steps to reproduce:
1. Apply attached patch
2. Run AutomatedSuite in the UI plugin
Comment 1 Jason Montojo CLA 2007-04-27 11:58:37 EDT
Created attachment 65223 [details]
Patch to expose race condition

This patch throws an exception when it detects a null ICProjectDescription instead of working around it.
Comment 2 Mikhail Sennikovsky CLA 2007-05-04 08:55:20 EDT
After taking a quick look into the problem it seems that the CProjectDescriptionManager is working correctly. 

The null project description is returned for the projects that do not really exist.

The scenario I'm observing looks like the following:
1. The project "foo" is created in the test "bar".
2. some jobs dealing with the project "foo" are running
3. test "bar" completes, the project "foo" gets deleted
4. BUT there are still some jobs running and referencing the deleted project
5. getProjectDescription is called for the deleted project "foo" -> CoreException

Could the UI experts comment on why this could happen?

Thanks,
Mikhail
Comment 3 Mikhail Sennikovsky CLA 2007-05-04 08:59:06 EDT
(In reply to comment #2)
> 5. getProjectDescription is called for the deleted project "foo" ->
> CoreException
sorry, what I meant to say is that null project description is returned in this case

Mikhail
Comment 4 Mikhail Sennikovsky CLA 2007-05-04 09:12:32 EDT
Updating summary and reassigning back to the core inbox for more clarification
Below are stack traces explaining the issue.

Regards,
Mikhail

===Stack trace#1======
Daemon Thread [org.eclipse.cdt.internal.ui.text.CReconciler] (Suspended (breakpoint at line 693 in TranslationUnit))	
	WorkingCopy(TranslationUnit).getLanguage() line: 693	
	LanguageManager.getContributedModelBuilderFor(TranslationUnit) line: 291	
	WorkingCopy(TranslationUnit).parse(Map, IProgressMonitor) line: 598	
	WorkingCopy(TranslationUnit).buildStructure(OpenableInfo, IProgressMonitor, Map, IResource) line: 397	
	WorkingCopy(Openable).generateInfos(Object, Map, IProgressMonitor) line: 260	
	WorkingCopy(CElement).openWhenClosed(CElementInfo, IProgressMonitor) line: 394	
	WorkingCopy(CElement).getElementInfo(IProgressMonitor) line: 274	
	WorkingCopy(TranslationUnit).getElementInfo(IProgressMonitor) line: 385	
	WorkingCopy(CElement).getElementInfo() line: 264	
	WorkingCopy(Openable).getBuffer() line: 109	
	WorkingCopy(TranslationUnit).getContents() line: 415	
	WorkingCopy(TranslationUnit).getCodeReader() line: 818	
	WorkingCopy(TranslationUnit).getAST(IIndex, int) line: 759	
	ASTCache$1.run() line: 276	
	SafeRunner.run(ISafeRunnable) line: 37	
	ASTCache.createAST(ITranslationUnit, IIndex, IProgressMonitor) line: 270	
	ASTProvider.createAST(ICElement, IIndex, IProgressMonitor) line: 340	
	CEditor.reconciled(boolean) line: 2510	
	CReconcilingStrategy.reconcile(boolean) line: 160	
	CReconcilingStrategy.initialReconcile() line: 169	
	CReconciler(MonoReconciler).initialProcess() line: 103	
	AbstractReconciler$BackgroundThread.run() line: 170	

====Stack trace#2=====
Daemon Thread [org.eclipse.cdt.internal.ui.text.CReconciler] (Suspended (breakpoint at line 693 in TranslationUnit))	
	WorkingCopy(TranslationUnit).getLanguage() line: 693	
	WorkingCopy(TranslationUnit).getAST(IIndex, int) line: 762	
	ASTCache$1.run() line: 276	
	SafeRunner.run(ISafeRunnable) line: 37	
	ASTCache.createAST(ITranslationUnit, IIndex, IProgressMonitor) line: 270	
	ASTProvider.createAST(ICElement, IIndex, IProgressMonitor) line: 340	
	CEditor.reconciled(boolean) line: 2510	
	CReconcilingStrategy.reconcile(boolean) line: 160	
	CReconcilingStrategy.initialReconcile() line: 169	
	CReconciler(MonoReconciler).initialProcess() line: 103	
	AbstractReconciler$BackgroundThread.run() line: 170
Comment 5 Jason Montojo CLA 2007-05-04 09:21:45 EDT
Thanks for looking into this, Mikhail!

The reconciler (where the null ICProjectDescription is being returned) runs in a separate thread and periodically updates the model based on changes in the editor.  It looks like the reconciler is still being activated for a TranslationUnit whose parent IProject has already been deleted.  I'll investigate further.
Comment 6 Anton Leherbauer CLA 2007-05-07 04:53:48 EDT
The problem is that tests that open editors need to close them all before deleting the project(s). This should be part of the test's tearDown method.
Eclipse editors are not meant to close themselves when resources are no longer accessible.
I'll fix those tests that appear to fail with the patch of comment 1 applied.
Comment 7 Anton Leherbauer CLA 2007-05-07 05:53:44 EDT
Fixed the failing tests of AutomatedSuite.