Pierce01 / MinecraftLauncher-core

Lightweight module that downloads and runs Minecraft using javascript / NodeJS
MIT License
359 stars 82 forks source link

Forge Launch gets stuck at baking models, CPU usage spikes to constant 90+% #47

Closed userNullifiedProd closed 3 years ago

userNullifiedProd commented 4 years ago

Good day everyone.

I made a small launcher for a few modpacks of mine, but when I tried to launch a modpack it got stuck at baking models. It never gets stuck at the same model, and when it gets stuck the CPU just starts crunching something and I am not sure what.

Task Manager shows CPU usage at 90% or more. There is no crash log, and when I tried launching the modpack through an actual launcher that someone made it worked fine. It's in Electron, if that changes anything and the function is ran in the main.js file.

The version is 1.12.2, forge-1.12.2-14.23.5.2847-universal.jar.

Here is the function being called:

playModpack: function(id) {
    $.get('https://usernullifiedprod.github.io/json/launcher.json', function(data) {
        ipcRenderer.send("playPack", {
            id: id,
            username: store.get('username'),
            data: data,
            ram: store.get('modpack' + String(id) + '.ram')
        });
    });
}

This is the function itself:

ipcMain.on("playPack", (event, info) => {
    let currentForge = app.getPath('userData') + '\\Modpacks\\' + modpackNames[info.id - 1] + '\\forgeInstallers\\' + info.data['modpack' + String(info.id)].forgeFile + '.jar'
    if(info.username != undefined) {
      let startArgs = {
        clientPackage: null,
        authorization: Authenticator.getAuth(info.username),
        root: app.getPath('userData') + '/Modpacks/' + modpackNames[info.id - 1],
        version: {
            number: "1.12.2",
            type: "release"
        },
        memory: {
            max: parseInt(info.ram) * 1024,
            min: "2048"
        },
        customLaunchArgs: [
          '-Dfml.ignorePatchDiscrepancies=true',
          '-Dfml.ignoreInvalidMinecraftCertificates=true',
          '-XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump',
          '-Xms256m',
          '-Xmx' + String(parseInt(info.ram) * 1024) + 'm'
        ],
        forge: currentForge
      }

      launcher.launch(startArgs);

      launcher.on('debug', (e) => console.log(e));
      launcher.on('data', (e) => console.log(e));
    } else {
      win.webContents.send("playPack undefinedUsername");
    }
  });

My question is if there is any way of fixing this, because I ran out of ideas when the custom args did not help. If you need the mod list, or if this is not the right place to ask just tell me.

Thanks in advance!

Pierce01 commented 4 years ago

The discussion starts here https://discordapp.com/channels/568550848871923723/568552422247759884/735256769659666463

Looking into!

Pierce01 commented 3 years ago

Closing as this has grown stale. If the issue is still around with the recent forge change (f947379), please reopen.

MiMillieuh commented 1 year ago

This is still an issue as today on forge 1.12.2 2859

Pierce01 commented 1 year ago

Hello! The issue was solved when the user added these launch arguments, hope this helps! @MiMillieuh

[
  "-XX:+UnlockExperimentalVMOptions",
  "-XX:+UseG1GC",
  "-XX:G1NewSizePercent=20",
  "-XX:G1ReservePercent=20",
  "-XX:MaxGCPauseMillis=50",
  "-XX:G1HeapRegionSize=32M"
]
MiMillieuh commented 1 year ago

Hello! The issue was solved when the user added these launch arguments, hope this helps! @MiMillieuh

[
  "-XX:+UnlockExperimentalVMOptions",
  "-XX:+UseG1GC",
  "-XX:G1NewSizePercent=20",
  "-XX:G1ReservePercent=20",
  "-XX:MaxGCPauseMillis=50",
  "-XX:G1HeapRegionSize=32M"
]

I confirm that these args are fixing the issue, thanks for your help !