Skip to content

Fixes #1542 Set up Core Build configurations without deadlocks or mixed launch bar state - #1545

Open
anydoby wants to merge 1 commit into
eclipse-cdt:mainfrom
anydoby:issue-1542-launchbar-tracker
Open

anydoby wants to merge 1 commit into
eclipse-cdt:mainfrom
anydoby:issue-1542-launchbar-tracker

Conversation

@anydoby

@anydoby anydoby commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #1542

Why

CoreBuildLaunchBarTracker has two problems:

Fix

  • No CoreModel lock. It was only used to make read, change and set of the project description one step, in five copies of the same code. The workspace root rule does that too, and setDescription needs it anyway. With only one lock, there is no lock order to get wrong.
  • One place changes build configurations. A helper in CBuildConfigurationManager does it under the root rule. createBuildConfiguration, the tracker, CBuildConfiguration.setActive(), CoreBuildLaunchConfigDelegate.buildForLaunch() and the Docker ContainerLaunchConfigurationDelegate.buildForLaunch() use it.
  • The tracker job uses only the mode and target of its own change. It is now a WorkspaceJob.
  • org.eclipse.cdt.debug.core and org.eclipse.cdt.docker.launcher are added as friends of org.eclipse.cdt.internal.core.build. There is no API change.

Tests

New CoreBuildLaunchBarTrackerTests, run locally on Linux:

Test main This PR
quickChangesDoNotCreateConfigsForUnselectedCombinations fails: a debug/trackerTestTarget configuration is created, but Debug was never selected for that target passes
setActiveDoesNotDeadlockWithTracker fails: setActive() and the tracker job deadlock passes

CBuildConfigurationManagerTests, DefaultBuildConfigurationNameTests, DefaultBuildConfigurationNameTestsNoToolchains and ICBuildConfigurationProviderTests also pass.

This PR changes createBuildConfiguration like #1534 does, so whichever is merged second needs a small rebase.

🤖 Generated with Claude Code

@eclipse-cdt-bot

Copy link
Copy Markdown

This pull request changes some projects for the first time in this development cycle.
Therefore the following files need a version increment:

core/org.eclipse.cdt.core/META-INF/MANIFEST.MF
debug/org.eclipse.cdt.debug.core/META-INF/MANIFEST.MF

An additional commit containing all the necessary changes was pushed to the top of this PR's branch. To obtain these changes (for example if you want to push more changes) either fetch from your fork or apply the git patch.

Git patch
From 1fc4155950e07cc3b9d7a355da92ed440d232c64 Mon Sep 17 00:00:00 2001
From: Eclipse CDT Bot <cdt-bot@eclipse.org>
Date: Tue, 27 Oct 2026 21:11:15 +0000
Subject: [PATCH] Version bump(s) for 12.7.0 stream


diff --git a/core/org.eclipse.cdt.core/META-INF/MANIFEST.MF b/core/org.eclipse.cdt.core/META-INF/MANIFEST.MF
index fa7967e284..a3db9361a7 100644
--- a/core/org.eclipse.cdt.core/META-INF/MANIFEST.MF
+++ b/core/org.eclipse.cdt.core/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %pluginName
 Bundle-SymbolicName: org.eclipse.cdt.core; singleton:=true
-Bundle-Version: 9.3.200.qualifier
+Bundle-Version: 9.3.300.qualifier
 Bundle-Activator: org.eclipse.cdt.core.CCorePlugin
 Bundle-Vendor: %providerName
 Bundle-Localization: plugin
diff --git a/debug/org.eclipse.cdt.debug.core/META-INF/MANIFEST.MF b/debug/org.eclipse.cdt.debug.core/META-INF/MANIFEST.MF
index 9399a3e495..e62e744105 100644
--- a/debug/org.eclipse.cdt.debug.core/META-INF/MANIFEST.MF
+++ b/debug/org.eclipse.cdt.debug.core/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: %pluginName
 Bundle-SymbolicName: org.eclipse.cdt.debug.core; singleton:=true
-Bundle-Version: 9.0.300.qualifier
+Bundle-Version: 9.0.400.qualifier
 Bundle-Activator: org.eclipse.cdt.debug.core.CDebugCorePlugin
 Bundle-Vendor: %providerName
 Bundle-Localization: plugin
-- 
2.56.0

Further information are available in Common Build Issues - Missing version increments.

@github-actions

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Test Results

5 940 tests  +2   5 809 ✅ +2   26m 40s ⏱️ + 3m 9s
  218 suites +1     131 💤 ±0 
  218 files   +1       0 ❌ ±0 

Results for commit 642faa2. ± Comparison against base commit 402f775.

♻️ This comment has been updated with latest results.

@anydoby

anydoby commented Oct 27, 2026

Copy link
Copy Markdown
Contributor Author

Good evening. CI failed downloading org.eclipse.linuxtools.docker.core while the Linux Tools nightly was being republished. Could someone trigger the build again, please?

@jonahgraham

Copy link
Copy Markdown
Member

Retriggered.

@betamaxbandit can you review this?

@anydoby

anydoby commented Oct 27, 2026

Copy link
Copy Markdown
Contributor Author

@jonahgraham this one is quite a big code reorg, tried to replace three mutable last* fields, which every queued job read at run time and mixed with its own captured values, with one immutable record of the whole launch bar selection, so each run works from a consistent snapshot and three copy-pasted lock-and-update blocks become a single helper that can't take the locks in the wrong order. In a nutshell.

@jonahgraham

Copy link
Copy Markdown
Member

I like the idea of having a mutable record here. Thanks for cleaning that up.

@betamaxbandit and @DangMinhTam382 are the most knowledgeable and active people in this area, so I hope they can review.

return Status.OK_STATUS;
}
try {
setActiveBuildConfig(selection, monitor);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks fragile and unnecessary nested: we schedule a Job that runs synchronous workspace modification inside it. What about WorkspaceJob?
Also please have a look at this comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, good points. I reworked the PR:

  • The tracker job is now a WorkspaceJob with the workspace root rule, like before this PR.
  • I dropped the CoreModel lock entirely, which also answers your question on Fix deadlock for CBuildConfigurationManager and CoreBuildLaunchBarTracker #1534. It was only used by five copies of the same "read, change, set the project description" code. The root rule does the same, and setDescription needs it anyway. With one lock there is no lock order, so the deadlock can't happen.
  • One helper in CBuildConfigurationManager now does this change. The tracker, CBuildConfiguration.setActive(), CoreBuildLaunchConfigDelegate.buildForLaunch() and the Docker launcher's buildForLaunch() all use it. The helper takes the root rule itself, because the other callers don't run inside a workspace operation. In the tracker job that's just a nested run under the same rule.
  • The tracker job now uses only the mode and target of its own change, which fixes the mixed state.

About combining createBuildConfiguration with addBuildConfiguration: I agree, but it changes ICBuildConfigurationManager API, so I'd rather do it in a separate PR.

Drop the CoreModel lock around project description changes and rely on
the workspace root rule only, so there is no lock order to get wrong.
One helper in CBuildConfigurationManager now makes these changes for
the launch bar tracker, CBuildConfiguration.setActive() and the Core
Build and Docker buildForLaunch().

The tracker job now uses only the mode and target of its own launch bar
change, and is a WorkspaceJob.

Fixes eclipse-cdt#1542

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@anydoby
anydoby force-pushed the issue-1542-launchbar-tracker branch from 7ddbdf0 to 642faa2 Compare October 28, 2026 19:28
@anydoby
anydoby requested a review from ruspl-afed October 28, 2026 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enhance or Refactoring CoreBuildLaunchBarTracker.class

4 participants