diff --git a/src/main/java/net/fabricmc/loom/configuration/providers/forge/MinecraftPatchedProvider.java b/src/main/java/net/fabricmc/loom/configuration/providers/forge/MinecraftPatchedProvider.java index 7f242989..8946e99b 100644 --- a/src/main/java/net/fabricmc/loom/configuration/providers/forge/MinecraftPatchedProvider.java +++ b/src/main/java/net/fabricmc/loom/configuration/providers/forge/MinecraftPatchedProvider.java @@ -270,11 +270,13 @@ public class MinecraftPatchedProvider extends MergedMinecraftProvider { Path tmpSrg = getToSrgMappings(); Set mcLibs = getProject().getConfigurations().getByName(Constants.Configurations.MINECRAFT_DEPENDENCIES).resolve(); - ThreadingUtils.run(() -> { - Files.copy(SpecialSourceExecutor.produceSrgJar(getExtension().getMcpConfigProvider().getRemapAction(), getProject(), "client", mcLibs, clientJar, tmpSrg), minecraftClientSrgJar.toPath()); - }, () -> { - Files.copy(SpecialSourceExecutor.produceSrgJar(getExtension().getMcpConfigProvider().getRemapAction(), getProject(), "server", mcLibs, serverJar, tmpSrg), minecraftServerSrgJar.toPath()); - }); + // These can't be threaded because accessing getRemapAction().getMainClass() can cause a situation where + // 1. thread A has an FS open + // 2. thread B tries to open a new one, but fails + // 3. thread A closes its FS + // 4. thread B tries to get the already open one => crash + Files.copy(SpecialSourceExecutor.produceSrgJar(getExtension().getMcpConfigProvider().getRemapAction(), getProject(), "client", mcLibs, clientJar, tmpSrg), minecraftClientSrgJar.toPath()); + Files.copy(SpecialSourceExecutor.produceSrgJar(getExtension().getMcpConfigProvider().getRemapAction(), getProject(), "server", mcLibs, serverJar, tmpSrg), minecraftServerSrgJar.toPath()); } private Path getToSrgMappings() throws IOException { diff --git a/src/main/java/net/fabricmc/loom/util/srg/SpecialSourceExecutor.java b/src/main/java/net/fabricmc/loom/util/srg/SpecialSourceExecutor.java index 59392e94..300ae892 100644 --- a/src/main/java/net/fabricmc/loom/util/srg/SpecialSourceExecutor.java +++ b/src/main/java/net/fabricmc/loom/util/srg/SpecialSourceExecutor.java @@ -57,7 +57,7 @@ public class SpecialSourceExecutor { } public static Path produceSrgJar(RemapAction remapAction, Project project, String side, Set mcLibs, Path officialJar, Path mappings) - throws Exception { + throws IOException { Set filter = Files.readAllLines(mappings, StandardCharsets.UTF_8).stream() .filter(s -> !s.startsWith("\t")) .map(s -> s.split(" ")[0] + ".class")