Hi Sergey,
I'm not the one to go into technical details, but I only want to
highlight that the concurrent builder is experimental in 4.0.0.
Have a great evening
Matthias
Am 29.11.2026 um 16:24 schrieb Sergey Chernov:
I've seen the suggestion to get rid of MultiThreadedBuilder in one of the
recent topics (which I strongly advise not to do (-1), at least not in 4.0),
so I decided to recheck the current state of the concurrent builder
(-bconcurrent) for our project.
The 4.0.0-rc-7 simply failed with an error which seems to be fixed in the
current maven-4.0.x branch:
[ERROR] The builder requested using id = concurrent cannot be found -> [Help
1]
org.apache.maven.lifecycle.internal.builder.BuilderNotFoundException: The
builder requested using id = concurrent cannot be found
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (
LifecycleStarter.java:108)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
at org.apache.maven.cli.MavenCli.execute (MavenCli.java:919)
at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:285)
at org.apache.maven.cli.MavenCli.main (MavenCli.java:207)
at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (
DirectMethodHandleAccessor.java:104)
at java.lang.reflect.Method.invoke (Method.java:565)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (
Launcher.java:255)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch (
Launcher.java:201)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (
Launcher.java:361)
at org.codehaus.plexus.classworlds.launcher.Launcher.main (
Launcher.java:314)
Tried with the latest build from the branch, now this failure above is
gone, but the build performance is quite poor.
For comparison, simple mvn validate -bmultithreaded takes 0.5 sec on both
3.9.16 and 4.0.0-SNAPSHOT, but it takes 80 seconds for mvn validate
-bconcurrent. Worth to mention: in the reproducer the validate has
literally 0 mapped plugin goals, so this is a pure builder overhead.
In the past I've shared the server_subset reproducer project with Tamas and
Guillaume. I've rechecked, it still shows the problem.
I made a small Claude analysis, below is the machine output:
The build isn't deadlocked. It finished with BUILD SUCCESS, but it spent
minutes with the six builder threads at about 100% CPU. The log sat still
for long stretches, which is why it looks hung.
What the dumps show
- All 6 BuilderThread-* threads are RUNNABLE in every snapshot. They sit
in BuildPlanExecutor$BuildContext.executePlan at lines 542–544, inside
stream().allMatch(BuildStep::isDone). Each has used about 3s of CPU per
snapshot interval.
- The main thread is parked in PhasingExecutor.close, waiting for those
builders.
- No threads are blocked on locks, and jstack reports no deadlock.
Likely root cause: a quadratic scheduler in the concurrent builder
(-bconcurrent)
- After every step finishes, the thread that ran it calls executePlan()
(BuildPlanExecutor.java:~513). That call scans plan.sortedNodes() and, for
each node still in CREATED state, runs predecessors.allMatch(isDone).
- This repo has about 1,100 modules, and each module has many lifecycle
steps (setup, plan, each phase, teardown, and the after:* steps). So the
plan has tens of thousands of nodes.
- Every completed step triggers a full scan of all not-yet-started nodes.
That is O(steps²) work in total.
- Steps that end up skipped call executePlan() recursively, which makes it
worse.
- The scan holds the read lock. The plan() call takes the write lock on
each module's PLAN step, so the scans and the planning steps block each
other.
- The Skipping Rule Enforcement lines for config-tools show the log is
moving, but each real step is swamped by scheduling overhead.
Possible fixes
- Maintain a ready queue or a per-step counter of unfinished predecessors
that is decremented on completion, instead of rescanning the whole plan.
- Only scan the successors of the step that just finished.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]