Skip to content

Conversation

@shartte
Copy link
Contributor

@shartte shartte commented Jan 8, 2026

covers has observed in the wild that the installer may create a runaway number of threads (thousands upon thousands).
The analysis has shown that this is the case in java < 25 if the common ForkJoinPool has parallelism of less than 2. In that case, CompletableFuture#runAsync using that pool will fall back to use one thread per submitted task.
Since we submit tasks for every class in the game at once, that will lead to this issue.

The solution is to detect this and use a dedicated worker thread instead, which is also what Java 25 does.

See: https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/CompletableFuture.html

All async methods without an explicit Executor argument are performed using the ForkJoinPool.commonPool() (unless it does not support a parallelism level of at least two, in which case, a new Thread is created to run each task).

@neoforged-pr-publishing
Copy link

neoforged-pr-publishing bot commented Jan 8, 2026

  • Publish PR to GitHub Packages

Last commit published: 3ec10cc0465f9f52e827986bc5a95fa29e667fe5 - version: 4.0.16-pr-43-fix-fjp-parallelism

PR Publishing

The artifacts published by this PR:

Repository Declaration

In order to use the artifacts published by the PR, add the following repository to your buildscript:

repositories {
    maven {
        name = "Maven for PR #43" // https://github.com/neoforged/InstallerTools/pull/43
        url = uri("https://prmaven.neoforged.net/InstallerTools/pr43")
        content {
            includeModule("net.neoforged.installertools", "binarypatch-applier")
            includeModule("net.neoforged.installertools", "binarypatcher")
            includeModule("net.neoforged.installertools", "cli-utils")
            includeModule("net.neoforged.installertools", "installertools")
            includeModule("net.neoforged.installertools", "jarsplitter")
            includeModule("net.neoforged.installertools", "problems-api")
            includeModule("net.neoforged.installertools", "zipinject")
        }
    }
}

@shartte shartte force-pushed the fix-fjp-parallelism branch from 3ec10cc to 8300dd6 Compare January 8, 2026 12:05
Copy link
Member

@Technici4n Technici4n left a comment

Choose a reason for hiding this comment

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

Looks good but why mention Java < 25? Did this behavior change?

@shartte
Copy link
Contributor Author

shartte commented Jan 8, 2026

Looks good but why mention Java < 25? Did this behavior change?

yes it did in 25

@shartte shartte merged commit 1a089bc into main Jan 8, 2026
2 checks passed
@neoforged-releases
Copy link

🚀 This PR has been released as InstallerTools version 4.0.16.

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.

2 participants