Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 339542

Summary: Workspace source look up rule conflict
Product: [Eclipse Project] Platform Reporter: Michael Rennie <Michael_Rennie>
Component: DebugAssignee: Pawel Piech <pawel.1.piech>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: grant_gayed, pawel.1.piech, thatnitind
Version: 3.7Flags: Michael_Rennie: review+
Target Milestone: 3.7 M7   
Hardware: PC   
OS: Windows 7   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=578709
Whiteboard:
Attachments:
Description Flags
Patch to use the build rule in source lookup. none

Description Michael Rennie CLA 2011-03-10 10:56:45 EST
code from HEAD

When a source look up ocurrs that requires us to open (or touch) the Extenral JavaScript Source project, we get the following exception and no source is displayed:


java.lang.IllegalArgumentException: Attempted to beginRule: P/External JavaScript Source, does not match outer scope rule: Debug Source Lookup(596)
	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:335)
	at org.eclipse.core.internal.jobs.ImplicitJobs.begin(ImplicitJobs.java:85)
	at org.eclipse.core.internal.jobs.JobManager.beginRule(JobManager.java:286)
	at org.eclipse.core.internal.resources.WorkManager.checkIn(WorkManager.java:118)
	at org.eclipse.core.internal.resources.Workspace.prepareOperation(Workspace.java:2248)
	at org.eclipse.core.internal.resources.Project.open(Project.java:1084)
	at org.eclipse.core.internal.resources.Project.open(Project.java:1178)
	at org.eclipse.wst.jsdt.debug.internal.core.JavaScriptDebugPlugin.getExternalSourceProject(JavaScriptDebugPlugin.java:111)
	at org.eclipse.wst.jsdt.debug.internal.core.launching.JavaScriptSourcePathComputerDelegate.computeSourceContainers(JavaScriptSourcePathComputerDelegate.java:33)
	at org.eclipse.debug.internal.core.sourcelookup.SourcePathComputer.computeSourceContainers(SourcePathComputer.java:69)
	at org.eclipse.debug.core.sourcelookup.containers.DefaultSourceContainer.createSourceContainers(DefaultSourceContainer.java:112)
	at org.eclipse.debug.core.sourcelookup.containers.CompositeSourceContainer.getSourceContainers(CompositeSourceContainer.java:129)
	at org.eclipse.debug.core.sourcelookup.containers.CompositeSourceContainer.findSourceElements(CompositeSourceContainer.java:46)
	at org.eclipse.wst.jsdt.debug.internal.core.launching.JavaScriptSourceLookupParticipant.findSourceElements(JavaScriptSourceLookupParticipant.java:54)
	at org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector$SourceLookupQuery.run(AbstractSourceLookupDirector.java:141)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
	at org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector.doSourceLookup(AbstractSourceLookupDirector.java:490)
	at org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector.getSourceElement(AbstractSourceLookupDirector.java:758)
	at org.eclipse.debug.internal.ui.sourcelookup.SourceLookupFacility.lookup(SourceLookupFacility.java:148)
	at org.eclipse.debug.ui.DebugUITools.lookupSource(DebugUITools.java:958)
	at org.eclipse.debug.internal.ui.elements.adapters.StackFrameSourceDisplayAdapter$SourceLookupJob.run(StackFrameSourceDisplayAdapter.java:111)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

The part-fix for bug 327497 added the new source look up rule. Perhaps there is more to do here (or there) to avoid this problem.
Comment 1 Pawel Piech CLA 2011-03-11 01:44:30 EST
I guess our solution to serialize the source lookup operations jobs was a little too simplistic.  We have to assume that source display could touch (or open as is the case here) any resource in the workspace.  I guess that would be the IResourceRuleFactory.buildRule()?
Comment 2 Pawel Piech CLA 2011-03-11 01:51:52 EST
Created attachment 190957 [details]
Patch to use the build rule in source lookup.

This patch changes the source lookup job to use the buildRule().  It may have the weird side effect that source lookup will be delayed until a running build is completed.

The alternative is to forbid modifying resources during source lookup, which is not backward compatible in this case.  Or we could back out our partial fix for bug 327497.
Comment 3 Pawel Piech CLA 2011-03-11 17:02:33 EST
Mike reported that use of build rule resulted in deadlocks... not good :-(

So I reverted the use of scheduling rule in source lookup job.  Mike, please verify.
Comment 4 Michael Rennie CLA 2011-03-14 11:36:14 EDT
looks good.