Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 370112 - [target] LoadTargetDefinitionJob deadlocks when loading target definition
Summary: [target] LoadTargetDefinitionJob deadlocks when loading target definition
Status: VERIFIED FIXED
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.7.1   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 3.8 M6   Edit
Assignee: Curtis Windatt CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-30 06:02 EST by Idrissa Dieng CLA
Modified: 2012-02-21 09:57 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Idrissa Dieng CLA 2012-01-30 06:02:46 EST
Dear all,
Using the org.eclipse.pde.internal.core.target.provisional.LoadTargetDefinitionJob class to load a target definition, we often obtain a deadlock that is caused by the use of a join inside the LoadTargetDefinitionJob#handleReload(String, List, PDEPreferencesManager, IProgressMonitor) method. 

This method instantiates the job TargetPlatformResetJob as follows:

Job job = new TargetPlatformResetJob(state);
job.schedule();
try {
    job.join();
} catch (InterruptedException e) {
}

I propose to remove the "job.join();" and I take this occasion to suggest to add the getTargetDefinition() method that returns the target definition being loaded.

Best regards.
Comment 1 Remy Suen CLA 2012-01-30 14:20:55 EST
PDE bugs go to PDE.
Comment 2 Idrissa Dieng CLA 2012-01-30 15:47:02 EST
Thank you for putting the bug in PDE. I had not done becauce the bug does not affect UI aspects and I have not found a component for PDE core bugs.

(In reply to comment #1)
> PDE bugs go to PDE.
Comment 3 Curtis Windatt CLA 2012-02-01 14:24:54 EST
What is the reset job waiting on that is causing your deadlock?  It is a normal job (no workspace/ui dependencies) with no additional rules.

A better solution would to move the code in the reset job to the load target job.  There is no benefit to having them as separate jobs.
Comment 4 Idrissa Dieng CLA 2012-02-01 15:09:35 EST
(In reply to comment #3)
> What is the reset job waiting on that is causing your deadlock?  It is a normal
> job (no workspace/ui dependencies) with no additional rules.
> 

The root cause is the TargetPlatformResetJob has IWorkspaceRoot(i.e., ResourcesPlugin.getWorkspace().getRoot()) as scheduling rule.

> A better solution would to move the code in the reset job to the load target
> job.  There is no benefit to having them as separate jobs.

yes I think also it's better to merge the code of these 2 classes.
Comment 5 Curtis Windatt CLA 2012-02-17 16:52:01 EST
Fixed in master:
http://git.eclipse.org/c/pde/eclipse.pde.ui.git/commit/?id=7e200f86008e4256c55d4dd3f99ca9bd0ef988f0

Idrissa, please verify that this solves your deadlock issue.
Comment 6 Idrissa Dieng CLA 2012-02-20 03:23:23 EST
Ok thansk!! I will test and inform you.

(In reply to comment #5)
> Fixed in master:
> http://git.eclipse.org/c/pde/eclipse.pde.ui.git/commit/?id=7e200f86008e4256c55d4dd3f99ca9bd0ef988f0
> 
> Idrissa, please verify that this solves your deadlock issue.
Comment 7 Idrissa Dieng CLA 2012-02-20 10:15:45 EST
Hello Curtis,
yes this fixe the deadlock in our side. It's very cool.
Comment 8 Curtis Windatt CLA 2012-02-21 09:57:09 EST
Verified by the reporter.