Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 315117 - xlc scanner discovery scheduling rule issue
Summary: xlc scanner discovery scheduling rule issue
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-build (show other bugs)
Version: 7.0   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: 7.0   Edit
Assignee: Chris Recoskie CLA
QA Contact: Andrew Gvozdev CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-31 13:02 EDT by Chris Recoskie CLA
Modified: 2011-01-22 08:16 EST (History)
2 users (show)

See Also:
jamesblackburn+eclipse: review+


Attachments
patch (1.03 KB, patch)
2010-05-31 13:03 EDT, Chris Recoskie CLA
recoskie: iplog-
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Recoskie CLA 2010-05-31 13:02:43 EDT
Currently, when you create a new project and the per-project scanner discovery gets kicked off, the IDE complains about the scheduling rule used by the xlc collector to update the info in the job it kicks off.  It should block on the workspace root instead of the project, as some project description updates still seem to want to grab the workspace root.

Here was the stack trace:

org.eclipse.core.runtime.CoreException: Attempted to beginRule: R/, does not match outer scope rule: P/test_8_0
	at org.eclipse.cdt.internal.core.settings.model.ExceptionFactory.createCoreException(ExceptionFactory.java:26)
	at org.eclipse.cdt.internal.core.settings.model.AbstractCProjectDescriptionStorage.setProjectDescription(AbstractCProjectDescriptionStorage.java:205)
	at org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionStorageManager.setProjectDescription(CProjectDescriptionStorageManager.java:147)
	at org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionManager.setProjectDescription(CProjectDescriptionManager.java:836)
	at org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionManager.setProjectDescription(CProjectDescriptionManager.java:806)
	at org.eclipse.cdt.make.xlc.core.scannerconfig.PerFileXLCScannerInfoCollector$ScannerConfigUpdateJob.run(PerFileXLCScannerInfoCollector.java:166)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: java.lang.IllegalArgumentException: Attempted to beginRule: R/, does not match outer scope rule: P/test_8_0
	at org.eclipse.core.runtime.Assert.isLegal(Assert.java:63)
	at org.eclipse.core.internal.jobs.ThreadJob.illegalPush(ThreadJob.java:136)
	at org.eclipse.core.internal.jobs.ThreadJob.push(ThreadJob.java:326)
	at org.eclipse.core.internal.jobs.ImplicitJobs.begin(ImplicitJobs.java:85)
	at org.eclipse.core.internal.jobs.JobManager.beginRule(JobManager.java:285)
	at org.eclipse.core.internal.resources.WorkManager.checkIn(WorkManager.java:117)
	at org.eclipse.core.internal.resources.Workspace.prepareOperation(Workspace.java:1914)
	at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1970)
	at org.eclipse.cdt.internal.core.model.CModelOperation.runOperation(CModelOperation.java:635)
	at org.eclipse.cdt.internal.core.settings.model.AbstractCProjectDescriptionStorage.setProjectDescription(AbstractCProjectDescriptionStorage.java:203)
	... 5 more
Comment 1 Chris Recoskie CLA 2010-05-31 13:03:54 EDT
Created attachment 170566 [details]
patch

Attached a proposed patch.
Comment 2 Chris Recoskie CLA 2010-05-31 13:06:47 EDT
I'm going to try this at home just to make sure of no weird deadlock issues.

In the meantime, if you guys would be willing to review it and let me know your thoughts, I'd appreciate it.
Comment 3 James Blackburn CLA 2010-06-01 04:37:38 EDT
Yes, this is an issue. When fiddling with the project description stuff I tried to reduce the sched rule scope to the project, but this broke a bunch of indexer tests which assert that the WR rule is held during set. I filed bug 278636 for this.

Using the WR rule is ok here. The alternative is to use an ILock if you're just trying to prevent concurrent running of your ScannerConfigUpdateJob.  The WR is safer however if you're get()ing and set()ing the projdesc as it looks like you're trying to do.  If this is ok performance-wise I'd do this for the moment and optimize it later.
Comment 4 Chris Recoskie CLA 2010-06-02 08:42:38 EDT
No deadlocks that I can find...

Committed to HEAD.
Comment 6 James Blackburn CLA 2011-01-22 08:16:22 EST
Acknowledge review flag, committed some time ago.