Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Johnston2018-10-12 17:09:43 +0000
committerJeff Johnston2018-10-12 17:14:52 +0000
commitc9eee479b4c714509e1b006063a4cbdaeed9cdc4 (patch)
tree2b9a0c0242765a2f0ba22903b30007663361960a
parentefbda46cba9dbb17eaebf74013021ea1ab8114fb (diff)
downloadorg.eclipse.cdt-c9eee479b4c714509e1b006063a4cbdaeed9cdc4.tar.gz
org.eclipse.cdt-c9eee479b4c714509e1b006063a4cbdaeed9cdc4.tar.xz
org.eclipse.cdt-c9eee479b4c714509e1b006063a4cbdaeed9cdc4.zip
Bug 540085 - Deadlock in ToolChainManager init
- modify ContainerGCCToolChainProvider.init so that the CBuildConfigurationManager.recheckConfigs() call is done within a separate job so the init() call will return without causing deadlock - do the same for ContainerTargetTypeProvider - modify CBuildConfigurationManager initProviders() method to be synchronized Change-Id: I4ca9371fb340887233872b6d315621a24450fb2b
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/CBuildConfigurationManager.java2
-rw-r--r--launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/docker/launcher/ContainerTargetTypeProvider.java25
-rw-r--r--launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/launchbar/ContainerGCCToolChainProvider.java26
3 files changed, 39 insertions, 14 deletions
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/CBuildConfigurationManager.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/CBuildConfigurationManager.java
index eaa35c8ec4f..f46b06675a9 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/CBuildConfigurationManager.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/build/CBuildConfigurationManager.java
@@ -101,7 +101,7 @@ public class CBuildConfigurationManager implements ICBuildConfigurationManager,
ResourcesPlugin.getWorkspace().removeResourceChangeListener(this);
}
- private void initProviders() {
+ private synchronized void initProviders() {
if (providers == null) {
providers = new HashMap<>();
diff --git a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/docker/launcher/ContainerTargetTypeProvider.java b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/docker/launcher/ContainerTargetTypeProvider.java
index 297359f6762..83752285352 100644
--- a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/docker/launcher/ContainerTargetTypeProvider.java
+++ b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/docker/launcher/ContainerTargetTypeProvider.java
@@ -123,12 +123,25 @@ public class ContainerTargetTypeProvider
DockerConnectionManager.getInstance()
.addConnectionManagerListener(this);
- // call the recheckConfigs method in case any disabled targets are now
- // ok
- ICBuildConfigurationManager mgr = CCorePlugin
- .getService(ICBuildConfigurationManager.class);
- ICBuildConfigurationManager2 manager = (ICBuildConfigurationManager2) mgr;
- manager.recheckConfigs();
+ // re-check configs in case an enabled Connection has made old configs
+ // valid again do this in a separate job to prevent a possible
+ // deadlock trying to get the lock on the CBuildConfigurationManager
+ // "configs" map (Bug 540085)
+ Job checkConfigs = new Job("Check configs") { //$NON-NLS-1$
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ // call the recheckConfigs method in case any disabled targets
+ // are now
+ // ok
+ ICBuildConfigurationManager mgr = CCorePlugin
+ .getService(ICBuildConfigurationManager.class);
+ ICBuildConfigurationManager2 cbuildmanager = (ICBuildConfigurationManager2) mgr;
+ cbuildmanager.recheckConfigs();
+ return Status.OK_STATUS;
+ }
+ };
+ checkConfigs.setUser(true);
+ checkConfigs.schedule();
try {
launchbarManager.setActiveLaunchTarget(defaultTarget);
diff --git a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/launchbar/ContainerGCCToolChainProvider.java b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/launchbar/ContainerGCCToolChainProvider.java
index defb52a92a8..9bcad227db2 100644
--- a/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/launchbar/ContainerGCCToolChainProvider.java
+++ b/launch/org.eclipse.cdt.docker.launcher/src/org/eclipse/cdt/internal/docker/launcher/ui/launchbar/ContainerGCCToolChainProvider.java
@@ -98,13 +98,25 @@ public class ContainerGCCToolChainProvider
DockerConnectionManager.getInstance()
.addConnectionManagerListener(this);
- // call the recheckConfigs method in case any disabled targets are now
- // ok
- ICBuildConfigurationManager mgr = CCorePlugin
- .getService(ICBuildConfigurationManager.class);
- ICBuildConfigurationManager2 cbuildmanager = (ICBuildConfigurationManager2) mgr;
- cbuildmanager.recheckConfigs();
-
+ // re-check configs in case an enabled Connection has made old configs
+ // valid again do this in a separate job to prevent a possible
+ // deadlock trying to get the lock on the CBuildConfigurationManager
+ // "configs" map (Bug 540085)
+ Job checkConfigs = new Job("Check configs") { //$NON-NLS-1$
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ // call the recheckConfigs method in case any disabled targets
+ // are now
+ // ok
+ ICBuildConfigurationManager mgr = CCorePlugin
+ .getService(ICBuildConfigurationManager.class);
+ ICBuildConfigurationManager2 cbuildmanager = (ICBuildConfigurationManager2) mgr;
+ cbuildmanager.recheckConfigs();
+ return Status.OK_STATUS;
+ }
+ };
+ checkConfigs.setUser(true);
+ checkConfigs.schedule();
}
@Override

Back to the top