Skip to content

An interrupted thread can't load new classes #431

@VidTu

Description

@VidTu

a simple mod consisting of two classes (shown below) won't be able to load new classes if the current thread is interrupted. this does NOT happen on fabric. an interrupted thread should not do anything by design, but additional class-loading may still occur in rare cases. tested on quilt loader 0.25.0, 0.26.0-beta.1 (where the bug exists) and fabric 0.15.11 (where the bug does not exist). a -Dloader.workaround.jar_copy_all_mods=true JVM flag makes everything work once again.

Main class:

package test.test;

import net.fabricmc.api.ModInitializer;

public class TestMod implements ModInitializer {
    @Override
    public void onInitialize() {
        new Thread(() -> {
            try {
                System.out.println("Interrupting...");
                Thread.currentThread().interrupt();
                System.out.println("Loading...");
                ExampleClass object = new ExampleClass();
                System.out.println("Success.");
            } catch (Throwable t) {
                t.printStackTrace();
                System.exit(-1);
            }
        }).start();
    }
}

Additional stub class:

package test.test;

public class ExampleClass {
    // Stub
}

(P.S. Yes, this issue was edited, because I've deleted my old repository with the code)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugsomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions