Mixin icon indicating copy to clipboard operation
Mixin copied to clipboard

Deadlock in MixinBootstrap.init();

Open Splatcrafter opened this issue 1 year ago • 2 comments

Hello,

I'm trying to use Mixin as a Java agent to create a custom usage for all Minecraft client versions, including customized ones like LabyMod, Feather, Vanilla, etc., since they are most likely to use the same obfuscated client code as Vanilla.

Currently, I'm facing an issue where the agent freezes on MixinBootstrap.init().

By "freezing," I mean that all logs before the init() call are created successfully, but any logs or operations after the init() call are not executed. My agent appears to hang without throwing any error, while Minecraft continues to run as if nothing happened.

Here’s the relevant code snippet:

private void initializeMixins() {
    printer.info("Initializing Mixins");
    try {
        MixinBootstrap.init();
    } catch (Exception e) {
        printer.log(Level.SEVERE, "Failed to initialize Mixins", e);
    }
    printer.info("Mixins initialized");
    Mixins.addConfiguration("mixin.blackstone.json");
    printer.info("Mixins configuration added");
}

In the logs, I can see the line "Initializing Mixins", but after that, there’s no "Mixins initialized", no "Mixins configuration added", and no errors. My first impression was that it might be a deadlock or something I misconfigured, such as using a wrong method or missing dependency, but I have no clue at the moment.

Additional Details:

  • I'm using the Java Instrumentation API with the -javaagent argument.
  • The program is run from a FAT-JAR containing all dependencies, including Mixin and ASM.
  • Used versions:
    • Mixin: 0.8.3
    • ASM/Util: 9.7

If someone could provide guidance or point out what I might have done wrong, I would greatly appreciate it.

Best regards, Splatcrafter

Splatcrafter avatar Dec 15 '24 12:12 Splatcrafter

Might care to use the jstack command to give a threaddump of this deadlock?

Also, Mixin 0.8.3 is rather outdated, you might want to update it.

Geolykt avatar Dec 15 '24 12:12 Geolykt

I used jstack to capture a thread dump after encountering the issue where the agent freezes on MixinBootstrap.init(). I also updated Mixin to version 0.8.5, but the behavior remains unchanged.

Below is the full thread dump: thread-dump.log

From my analysis, Minecraft itself continues running without any issues, but the agent seems to hang during the initialization process. I couldn’t identify any Java-level deadlocks or specific blocked threads, but I might have missed something.

I’d appreciate any further guidance or insights into what might be causing this.

Splatcrafter avatar Dec 15 '24 12:12 Splatcrafter