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

Bug 273079

Summary: Threading issue in Project.updateDescription
Product: [Eclipse Project] Platform Reporter: Elliott Baron <ebaron>
Component: ResourcesAssignee: Platform-Resources-Inbox <platform-resources-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: sptaszkiewicz
Version: 3.4.1   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Elliott Baron CLA 2009-04-21 10:59:45 EDT
I've recently encountered a problem that leads to a project's list of enabled natures being inaccurate.

1. [Thread 1] ImportOperation on project
2. [Thread 1] Imports .project file with new natures
3. [Thread 1] Project.updateDescription() is called
4. [Thread 1] Broadcasts LifecycleEvent.PRE_PROJECT_CHANGE
5. [Thread 1] NatureManager.handleEvent(LifecycleEvent) calls flushEnablements(IProject)
6. [Thread 2] Another thread calls NatureMangager.getEnabledNatures(Project)
7. [Thread 2] NatureManager.computeNatureEnablements(Project) is called using old project description
8. [Thread 1] Calls Project.internalSetDescription() is called from updateDescription()

There needs to be synchronization so the nature enablements cannot be computed between the PRE_PROJECT_CHANGE event being fired and the call to internalSetDescription.

This can lead to problems building the project because the natures required for the builders are not present.
Comment 1 Szymon Ptaszkiewicz CLA 2012-04-03 07:32:35 EDT

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