Bug 251408 - Nested Projects: CVS Replace of .project file in outer project causes ThreadJob.illegalPush
Summary: Nested Projects: CVS Replace of .project file in outer project causes ThreadJ...
Status: RESOLVED DUPLICATE of bug 251370
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Resources (show other bugs)
Version: 3.4   Edit
Hardware: PC Linux-GTK
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-Resources-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 245412
Blocks:
  Show dependency tree
 
Reported: 2008-10-20 10:56 EDT by James Blackburn CLA
Modified: 2009-02-17 17:06 EST (History)
1 user (show)

See Also:


Attachments
Patch to run project level refresh in a separate WorkspaceJob (2.85 KB, patch)
2008-10-20 11:29 EDT, James Blackburn CLA
no flags Details | Diff
Patch 2 (2.76 KB, patch)
2008-12-05 08:30 EST, James Blackburn CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description James Blackburn CLA 2008-10-20 10:56:11 EDT
Build ID: 3.4

Steps To Reproduce:
I have a workspace with two projects one (inner project) whose location is within another (outer project).

If I CVS override and update the .project file of the inner project from the context of the outer project (while the inner project is open) I may get an illegal push during Project.reconcileLinks.  

This is because reconcileLinks may do oldLinkResource.delete(...) where oldLinkResource is a resource in the inner project and the currently held scheduling rule is the container outer project.

Perhaps AliasManager.updateAliases(...) should call FSRM.refresh(...) in the same thread when the resource in question is a project...

Stack attached.

More information:
Thread [Worker-40] (Suspended (exception IllegalArgumentException))
owns: ImplicitJobs  (id=381)
owns: HashSet<E>  (id=382)
Assert.isLegal(boolean, String) line: 64
ThreadJob.illegalPush(ISchedulingRule, ISchedulingRule) line: 122
ThreadJob.push(ISchedulingRule) line: 232
ImplicitJobs.begin(ISchedulingRule, IProgressMonitor, boolean) line: 58
JobManager.beginRule(ISchedulingRule, IProgressMonitor) line: 230
WorkManager.checkIn(ISchedulingRule, IProgressMonitor) line: 117
Workspace.prepareOperation(ISchedulingRule, IProgressMonitor) line: 1881
Folder(Resource).delete(int, IProgressMonitor) line: 767
Project.reconcileLinksAndGroups(ProjectDescription) line: 955
Project.updateDescription() line: 1187
File.updateMetadataFiles() line: 411
RefreshLocalVisitor.visit(UnifiedTreeNode) line: 306
UnifiedTree.accept(IUnifiedTreeVisitor, int) line: 99
FileSystemResourceManager.refreshResource(IResource, int, boolean, IProgressMonitor) line: 788
FileSystemResourceManager.refresh(IResource, int, boolean, IProgressMonitor) line: 772
AliasManager.updateAliases(IResource, IFileStore, int, IProgressMonitor) line: 682
File.internalSetContents(InputStream, IFileInfo, int, boolean, IProgressMonitor) line: 333
File.setContents(InputStream, int, IProgressMonitor) line: 370
File.setContents(InputStream, boolean, boolean, IProgressMonitor) line: 470
MergeContext$5.run(IProgressMonitor) line: 359
CVSSubscriberMergeContext$3.run(IProgressMonitor) line: 84
EclipseSynchronizer.run(ISchedulingRule, ICVSRunnable, IProgressMonitor) line: 1481
CVSSubscriberMergeContext$2.run(IProgressMonitor) line: 81
Workspace.run(IWorkspaceRunnable, ISchedulingRule, int, IProgressMonitor) line: 1934
WorkspaceSubscriberContext(MergeContext).run(IWorkspaceRunnable, ISchedulingRule, int, IProgressMonitor) line: 409
WorkspaceSubscriberContext(CVSSubscriberMergeContext).run(IWorkspaceRunnable, ISchedulingRule, int, IProgressMonitor) line: 79
WorkspaceSubscriberContext(MergeContext).performReplace(IDiff, IFile, IFileRevision, IProgressMonitor) line: 346
WorkspaceSubscriberContext(MergeContext).performReplace(IDiff, IProgressMonitor) line: 323
WorkspaceSubscriberContext.performReplace(IDiff, IProgressMonitor) line: 440
WorkspaceSubscriberContext(MergeContext).merge(IDiff, boolean, IProgressMonitor) line: 168
WorkspaceSubscriberContext.merge(IDiff, boolean, IProgressMonitor) line: 255
MergeContext$3.run(IProgressMonitor) line: 87
CVSSubscriberMergeContext$3.run(IProgressMonitor) line: 84
EclipseSynchronizer.run(ISchedulingRule, ICVSRunnable, IProgressMonitor) line: 1481
CVSSubscriberMergeContext$2.run(IProgressMonitor) line: 81
Workspace.run(IWorkspaceRunnable, ISchedulingRule, int, IProgressMonitor) line: 1934
WorkspaceSubscriberContext(MergeContext).run(IWorkspaceRunnable, ISchedulingRule, int, IProgressMonitor) line: 409
WorkspaceSubscriberContext(CVSSubscriberMergeContext).run(IWorkspaceRunnable, ISchedulingRule, int, IProgressMonitor) line: 79
WorkspaceSubscriberContext(MergeContext).merge(IDiff[], boolean, IProgressMonitor) line: 81
CVSSubscriberMergeContext.access$1(CVSSubscriberMergeContext, IDiff[], boolean, IProgressMonitor) line: 1
WorkspaceSubscriberContext(CVSSubscriberMergeContext).internalMerge(IDiff[], boolean, IProgressMonitor) line: 174
CVSSubscriberMergeContext.access$0(CVSSubscriberMergeContext, IDiff[], boolean, IProgressMonitor) line: 128
CVSSubscriberMergeContext$4.run(IProgressMonitor) line: 122
CVSSubscriberMergeContext$3.run(IProgressMonitor) line: 84
EclipseSynchronizer.run(ISchedulingRule, ICVSRunnable, IProgressMonitor) line: 1481
CVSSubscriberMergeContext$2.run(IProgressMonitor) line: 81
Workspace.run(IWorkspaceRunnable, ISchedulingRule, int, IProgressMonitor) line: 1934
WorkspaceSubscriberContext(MergeContext).run(IWorkspaceRunnable, ISchedulingRule, int, IProgressMonitor) line: 409
WorkspaceSubscriberContext(CVSSubscriberMergeContext).run(IWorkspaceRunnable, ISchedulingRule, int, IProgressMonitor) line: 79
WorkspaceSubscriberContext(CVSSubscriberMergeContext).merge(IDiff[], boolean, IProgressMonitor) line: 120
WorkspaceSubscriberContext.merge(IDiff[], boolean, IProgressMonitor) line: 385
ResourceMergeHandler$1.execute(IProgressMonitor) line: 58
ResourceMergeHandler$1(SynchronizationOperation).run(IProgressMonitor) line: 120
TeamOperation$TeamOperationJobContext(JobRunnableContext).run(IRunnableWithProgress, IProgressMonitor) line: 144
JobRunnableContext$ResourceJob.runInWorkspace(IProgressMonitor) line: 72
JobRunnableContext$ResourceJob(InternalWorkspaceJob).run(IProgressMonitor) line: 38
Worker.run() line: 55
Comment 1 James Blackburn CLA 2008-10-20 11:29:05 EDT
Created attachment 115576 [details]
Patch to run project level refresh in a separate WorkspaceJob

So this patch causes the refresh to happen in a separate workspace job which should allow the updates to take place irrespective of the currently selected scheduling rules.
Comment 2 Martin Oberhuber CLA 2008-10-30 15:42:18 EDT
I think that this should be fixed at the root cause - by disallowing project overlap as suggested by bug 245412 comment 4 (masking out the folder of the physically nested project from its container).
Comment 3 James Blackburn CLA 2008-12-05 08:30:26 EST
Created attachment 119617 [details]
Patch 2

Use resource.refreshLocal(...) rather than localManager.refresh() to prevent operation not prepared error.
Comment 4 James Blackburn CLA 2009-02-17 17:06:10 EST
I've attached a fix to bug251370. This fixes both the nested refresh (concurrent iteration over the alias manager hashset issue) and this issue of incorrect scheduling rules held when a thread holding a scheduling rule does a setContents() on an aliased project description file.  This edge case causes core.resources to attempt to grab an incompatible scheduling rule.

The approach I've taken to fix this is to simply schedule the refresh with the refresh manager.

*** This bug has been marked as a duplicate of bug 251370 ***